aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rw-r--r--Makefile2
-rw-r--r--lua_cjson.c9
-rw-r--r--manual.txt4
-rwxr-xr-xtests/test.lua2
5 files changed, 9 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3768fc4..c18381f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,7 @@
6project(lua-cjson C) 6project(lua-cjson C)
7cmake_minimum_required(VERSION 2.6) 7cmake_minimum_required(VERSION 2.6)
8 8
9option(DISABLE_CJSON_GLOBAL "Disable global registration of the 'cjson' module table") 9option(ENABLE_CJSON_GLOBAL "Register cjson module table as a global variable - not recommended")
10option(USE_INTERNAL_DTOA "Use internal strtod() / dtoa code for performance") 10option(USE_INTERNAL_DTOA "Use internal strtod() / dtoa code for performance")
11option(MULTIPLE_THREADS 11option(MULTIPLE_THREADS
12 "Build internal dtoa with support for multi-threaded applications - recommended" ON) 12 "Build internal dtoa with support for multi-threaded applications - recommended" ON)
@@ -20,8 +20,8 @@ endif()
20find_package(Lua51 REQUIRED) 20find_package(Lua51 REQUIRED)
21include_directories(${LUA_INCLUDE_DIR}) 21include_directories(${LUA_INCLUDE_DIR})
22 22
23if(DISABLE_CJSON_GLOBAL) 23if(ENABLE_CJSON_GLOBAL)
24 add_definitions(-DDISABLE_CJSON_GLOBAL) 24 add_definitions(-DENABLE_CJSON_GLOBAL)
25endif() 25endif()
26 26
27if(NOT USE_INTERNAL_DTOA) 27if(NOT USE_INTERNAL_DTOA)
diff --git a/Makefile b/Makefile
index bf2b07f..9fb8d0b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1##### Available defines for CJSON_CFLAGS ##### 1##### Available defines for CJSON_CFLAGS #####
2## 2##
3## USE_INTERNAL_ISINF: Workaround for Solaris platforms missing isinf(). 3## USE_INTERNAL_ISINF: Workaround for Solaris platforms missing isinf().
4## DISABLE_CJSON_GLOBAL: Do not store module is "cjson" global. 4## ENABLE_CJSON_GLOBAL: Register "cjson" module table as a global variable.
5## DISABLE_INVALID_NUMBERS: Permanently disable invalid JSON numbers: 5## DISABLE_INVALID_NUMBERS: Permanently disable invalid JSON numbers:
6## NaN, Infinity, hex. 6## NaN, Infinity, hex.
7## 7##
diff --git a/lua_cjson.c b/lua_cjson.c
index 0662414..118ca27 100644
--- a/lua_cjson.c
+++ b/lua_cjson.c
@@ -1382,13 +1382,8 @@ int luaopen_cjson(lua_State *l)
1382{ 1382{
1383 lua_cjson_new(l); 1383 lua_cjson_new(l);
1384 1384
1385#if !defined(DISABLE_CJSON_GLOBAL) && (!defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502) 1385#ifdef ENABLE_CJSON_GLOBAL
1386 /* Register a global "cjson" table to maintain compatibility with earlier 1386 /* Register a global "cjson" table. */
1387 * versions of Lua CJSON which used luaL_register() under Lua 5.1.
1388 *
1389 * From Lua 5.2 onwards, Lua CJSON does not automatically register a global
1390 * table.
1391 */
1392 lua_pushvalue(l, -1); 1387 lua_pushvalue(l, -1);
1393 lua_setglobal(l, CJSON_MODNAME); 1388 lua_setglobal(l, CJSON_MODNAME);
1394#endif 1389#endif
diff --git a/manual.txt b/manual.txt
index 3417750..62485fd 100644
--- a/manual.txt
+++ b/manual.txt
@@ -113,9 +113,9 @@ Build Options (#define)
113~~~~~~~~~~~~~~~~~~~~~~~ 113~~~~~~~~~~~~~~~~~~~~~~~
114 114
115[horizontal] 115[horizontal]
116ENABLE_CJSON_GLOBAL:: Register +cjson+ module table as a global
117 variable (not recommended).
116USE_INTERNAL_ISINF:: Workaround for Solaris platforms missing ++isinf++(3). 118USE_INTERNAL_ISINF:: Workaround for Solaris platforms missing ++isinf++(3).
117DISABLE_CJSON_GLOBAL:: Do not store module table in global "cjson"
118 variable. Redundant from Lua 5.2 onwards.
119DISABLE_INVALID_NUMBERS:: Recommended on platforms where ++strtod++(3) / 119DISABLE_INVALID_NUMBERS:: Recommended on platforms where ++strtod++(3) /
120 ++sprintf++(3) are not POSIX compliant (Eg, Windows MinGW). Prevents 120 ++sprintf++(3) are not POSIX compliant (Eg, Windows MinGW). Prevents
121 +cjson.encode_invalid_numbers+ and +cjson.decode_invalid_numbers+ 121 +cjson.encode_invalid_numbers+ and +cjson.decode_invalid_numbers+
diff --git a/tests/test.lua b/tests/test.lua
index 19fc1af..152579e 100755
--- a/tests/test.lua
+++ b/tests/test.lua
@@ -69,7 +69,7 @@ function load_testdata()
69 69
70 local big = {} 70 local big = {}
71 for i = 1, 1100 do 71 for i = 1, 1100 do
72 big = { { 10, false, true, cjson.null }, "string", a = big } 72 big = { { 10, false, true, json.null }, "string", a = big }
73 end 73 end
74 data.deeply_nested_data = big 74 data.deeply_nested_data = big
75 75