aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorlijunlong <lijunlong@openresty.com>2026-02-10 09:08:50 +0800
committerlijunlong <lijunlong@openresty.com>2026-02-10 09:08:52 +0800
commitc305d55c7f321c01b4d135ef6d41879fd5f8e9f5 (patch)
treea7c5de1ef4ff7a5e83d55e60fa0e173832308575 /lua
parentfed8c8356be4d94ceb55f2880bdb77fd9b55ef1e (diff)
downloadlua-cjson-c305d55c7f321c01b4d135ef6d41879fd5f8e9f5.tar.gz
lua-cjson-c305d55c7f321c01b4d135ef6d41879fd5f8e9f5.tar.bz2
lua-cjson-c305d55c7f321c01b4d135ef6d41879fd5f8e9f5.zip
optimize: rename cjson.decoce_allow_comments to cjson.decocde_allow_comment.HEADmaster
reslove two warnings and update the doc.
Diffstat (limited to '')
-rw-r--r--lua_cjson.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lua_cjson.c b/lua_cjson.c
index de77f26..0ee9f7d 100644
--- a/lua_cjson.c
+++ b/lua_cjson.c
@@ -179,7 +179,7 @@ typedef struct {
179 int decode_invalid_numbers; 179 int decode_invalid_numbers;
180 int decode_max_depth; 180 int decode_max_depth;
181 int decode_array_with_array_mt; 181 int decode_array_with_array_mt;
182 int decode_allow_comments; 182 int decode_allow_comment;
183 int encode_skip_unsupported_value_types; 183 int encode_skip_unsupported_value_types;
184} json_config_t; 184} json_config_t;
185 185
@@ -386,11 +386,11 @@ static int json_cfg_decode_array_with_array_mt(lua_State *l)
386} 386}
387 387
388/* Configures whether decoder allows comments */ 388/* Configures whether decoder allows comments */
389static int json_cfg_decode_allow_comments(lua_State *l) 389static int json_cfg_decode_allow_comment(lua_State *l)
390{ 390{
391 json_config_t *cfg = json_arg_init(l, 1); 391 json_config_t *cfg = json_arg_init(l, 1);
392 392
393 json_enum_option(l, 1, &cfg->decode_allow_comments, NULL, 1); 393 json_enum_option(l, 1, &cfg->decode_allow_comment, NULL, 1);
394 394
395 return 1; 395 return 1;
396} 396}
@@ -527,7 +527,7 @@ static void json_create_config(lua_State *l)
527 cfg->encode_number_precision = DEFAULT_ENCODE_NUMBER_PRECISION; 527 cfg->encode_number_precision = DEFAULT_ENCODE_NUMBER_PRECISION;
528 cfg->encode_empty_table_as_object = DEFAULT_ENCODE_EMPTY_TABLE_AS_OBJECT; 528 cfg->encode_empty_table_as_object = DEFAULT_ENCODE_EMPTY_TABLE_AS_OBJECT;
529 cfg->decode_array_with_array_mt = DEFAULT_DECODE_ARRAY_WITH_ARRAY_MT; 529 cfg->decode_array_with_array_mt = DEFAULT_DECODE_ARRAY_WITH_ARRAY_MT;
530 cfg->decode_allow_comments = DEFAULT_DECODE_ALLOW_COMMENTS; 530 cfg->decode_allow_comment = DEFAULT_DECODE_ALLOW_COMMENTS;
531 cfg->encode_escape_forward_slash = DEFAULT_ENCODE_ESCAPE_FORWARD_SLASH; 531 cfg->encode_escape_forward_slash = DEFAULT_ENCODE_ESCAPE_FORWARD_SLASH;
532 cfg->encode_skip_unsupported_value_types = DEFAULT_ENCODE_SKIP_UNSUPPORTED_VALUE_TYPES; 532 cfg->encode_skip_unsupported_value_types = DEFAULT_ENCODE_SKIP_UNSUPPORTED_VALUE_TYPES;
533 cfg->encode_indent = DEFAULT_ENCODE_INDENT; 533 cfg->encode_indent = DEFAULT_ENCODE_INDENT;
@@ -1302,7 +1302,7 @@ static void json_next_token(json_parse_t *json, json_token_t *token)
1302 json->ptr++; 1302 json->ptr++;
1303 } 1303 }
1304 1304
1305 if (!json->cfg->decode_allow_comments) 1305 if (!json->cfg->decode_allow_comment)
1306 break; 1306 break;
1307 1307
1308 /* Eat comments. */ 1308 /* Eat comments. */
@@ -1671,7 +1671,7 @@ static int lua_cjson_new(lua_State *l)
1671 { "decode", json_decode }, 1671 { "decode", json_decode },
1672 { "encode_empty_table_as_object", json_cfg_encode_empty_table_as_object }, 1672 { "encode_empty_table_as_object", json_cfg_encode_empty_table_as_object },
1673 { "decode_array_with_array_mt", json_cfg_decode_array_with_array_mt }, 1673 { "decode_array_with_array_mt", json_cfg_decode_array_with_array_mt },
1674 { "decode_allow_comments", json_cfg_decode_allow_comments }, 1674 { "decode_allow_comment", json_cfg_decode_allow_comment },
1675 { "encode_sparse_array", json_cfg_encode_sparse_array }, 1675 { "encode_sparse_array", json_cfg_encode_sparse_array },
1676 { "encode_max_depth", json_cfg_encode_max_depth }, 1676 { "encode_max_depth", json_cfg_encode_max_depth },
1677 { "decode_max_depth", json_cfg_decode_max_depth }, 1677 { "decode_max_depth", json_cfg_decode_max_depth },