Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpx/lua-cjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Pulford <mark@kyne.com.au>2012-01-18 18:26:40 +0400
committerMark Pulford <mark@kyne.com.au>2012-03-04 12:24:35 +0400
commitdd231d4cd0e277fedb6ca23d9685202787dc65b1 (patch)
treebf187867fd91a5cc70505c2d441dc3a66e3bb86c
parent3040931d6bb7331b130fd4c34a7b17bc5d226039 (diff)
Remove deprecated "refuse_invalid_numbers"
Remove deprecated "refuse_invalid_numbers" since the version number will be bumped to 1.1.0. Also remove "version" variable since it has been replaced by _VERSION.
-rw-r--r--lua_cjson.c38
-rwxr-xr-xtests/test.lua4
2 files changed, 2 insertions, 40 deletions
diff --git a/lua_cjson.c b/lua_cjson.c
index 7f0bbb1..fea3ed5 100644
--- a/lua_cjson.c
+++ b/lua_cjson.c
@@ -354,41 +354,6 @@ static int json_cfg_decode_invalid_numbers(lua_State *l)
return 1;
}
-/* When enabled, rejects: NaN, Infinity, hexadecimal numbers.
- *
- * This function has been deprecated and may be removed in future. */
-static int json_cfg_refuse_invalid_numbers(lua_State *l)
-{
- static const char *options[] = { "none", "encode", "decode", "both", NULL };
- json_config_t *cfg = json_arg_init(l, 1);
- int setting;
-
- /* Map config variables to options list index */
- setting = !cfg->encode_invalid_numbers + /* bit 0 */
- (!cfg->decode_invalid_numbers << 1); /* bit 1 */
-
- json_enum_option(l, 1, &setting, options, 3);
-
- /* Map options list index to config variables
- *
- * Only update the config variables when an argument has been provided.
- * Otherwise a "null" encoding setting may inadvertently be disabled. */
- if (!lua_isnil(l, 1)) {
- cfg->encode_invalid_numbers = !(setting & 1);
- cfg->decode_invalid_numbers = !(setting & 2);
-
-#if DISABLE_INVALID_NUMBERS
- if (cfg->encode_invalid_numbers || cfg->decode_invalid_numbers) {
- cfg->encode_invalid_numbers = cfg->decode_invalid_numbers = 0;
- luaL_error(l, "Infinity, NaN, and/or hexadecimal numbers are not supported.");
- }
-#endif
-
- }
-
- return 1;
-}
-
static int json_destroy_config(lua_State *l)
{
json_config_t *cfg;
@@ -1348,7 +1313,6 @@ static int lua_cjson_new(lua_State *l)
{ "encode_keep_buffer", json_cfg_encode_keep_buffer },
{ "encode_invalid_numbers", json_cfg_encode_invalid_numbers },
{ "decode_invalid_numbers", json_cfg_decode_invalid_numbers },
- { "refuse_invalid_numbers", json_cfg_refuse_invalid_numbers },
{ "new", lua_cjson_new },
{ NULL, NULL }
};
@@ -1372,8 +1336,6 @@ static int lua_cjson_new(lua_State *l)
lua_setfield(l, -2, "_NAME");
lua_pushliteral(l, CJSON_VERSION);
lua_setfield(l, -2, "_VERSION");
- lua_pushliteral(l, CJSON_VERSION);
- lua_setfield(l, -2, "version");
return 1;
}
diff --git a/tests/test.lua b/tests/test.lua
index 2941a91..1bf8d2b 100755
--- a/tests/test.lua
+++ b/tests/test.lua
@@ -91,8 +91,8 @@ local testdata = load_testdata()
local cjson_tests = {
-- Test API variables
{ "Check module name, version",
- function () return json._NAME, json._VERSION, json.version end, { },
- true, { "cjson", "1.1devel", "1.1devel" } },
+ function () return json._NAME, json._VERSION end, { },
+ true, { "cjson", "1.1devel" } },
-- Test decoding simple types
{ "Decode string",