aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Pulford <mark@kyne.com.au>2011-12-31 17:02:12 +1030
committerMark Pulford <mark@kyne.com.au>2011-12-31 17:02:12 +1030
commit5dd3207e5fda2f8f502a8a2f32f5484ea3f758b5 (patch)
tree254c1ed1584ba289b08c836090738b7b5d028e91
parent0637fcaf549ce120efa541c8d7445cb36c30e53f (diff)
downloadlua-cjson-5dd3207e5fda2f8f502a8a2f32f5484ea3f758b5.tar.gz
lua-cjson-5dd3207e5fda2f8f502a8a2f32f5484ea3f758b5.tar.bz2
lua-cjson-5dd3207e5fda2f8f502a8a2f32f5484ea3f758b5.zip
Remove "update_locale" Lua function
Only update the locale when the module is initialised. cjson.new() can be used if the locale changes part way through program execution.
-rw-r--r--lua_cjson.c8
-rwxr-xr-xtests/test.lua4
2 files changed, 2 insertions, 10 deletions
diff --git a/lua_cjson.c b/lua_cjson.c
index 3a40e9a..e458fc3 100644
--- a/lua_cjson.c
+++ b/lua_cjson.c
@@ -344,13 +344,6 @@ static int json_cfg_refuse_invalid_numbers(lua_State *l)
344 return 1; 344 return 1;
345} 345}
346 346
347static int json_update_locale(lua_State *l)
348{
349 fpconv_update_locale();
350
351 return 0;
352}
353
354static int json_destroy_config(lua_State *l) 347static int json_destroy_config(lua_State *l)
355{ 348{
356 json_config_t *cfg; 349 json_config_t *cfg;
@@ -1284,7 +1277,6 @@ static int lua_cjson_new(lua_State *l)
1284 { "encode_number_precision", json_cfg_encode_number_precision }, 1277 { "encode_number_precision", json_cfg_encode_number_precision },
1285 { "encode_keep_buffer", json_cfg_encode_keep_buffer }, 1278 { "encode_keep_buffer", json_cfg_encode_keep_buffer },
1286 { "refuse_invalid_numbers", json_cfg_refuse_invalid_numbers }, 1279 { "refuse_invalid_numbers", json_cfg_refuse_invalid_numbers },
1287 { "update_locale", json_update_locale },
1288 { "new", lua_cjson_new }, 1280 { "new", lua_cjson_new },
1289 { NULL, NULL } 1281 { NULL, NULL }
1290 }; 1282 };
diff --git a/tests/test.lua b/tests/test.lua
index 99ac73a..6cb5666 100755
--- a/tests/test.lua
+++ b/tests/test.lua
@@ -211,14 +211,14 @@ local escape_tests = {
211local locale_tests = { 211local locale_tests = {
212 function () 212 function ()
213 os.setlocale("cs_CZ") 213 os.setlocale("cs_CZ")
214 json.update_locale() 214 json.new()
215 return "Setting locale to cs_CZ (comma separator)" 215 return "Setting locale to cs_CZ (comma separator)"
216 end, 216 end,
217 { json.encode, { 1.5 }, true, { '1.5' } }, 217 { json.encode, { 1.5 }, true, { '1.5' } },
218 { json.decode, { "[ 10, \"test\" ]" }, true, { { 10, "test" } } }, 218 { json.decode, { "[ 10, \"test\" ]" }, true, { { 10, "test" } } },
219 function () 219 function ()
220 os.setlocale("C") 220 os.setlocale("C")
221 json.update_locale() 221 json.new()
222 return "Reverting locale to POSIX" 222 return "Reverting locale to POSIX"
223 end 223 end
224} 224}