diff options
author | Mark Pulford <mark@kyne.com.au> | 2011-12-13 22:29:11 +1030 |
---|---|---|
committer | Mark Pulford <mark@kyne.com.au> | 2011-12-13 22:29:11 +1030 |
commit | 5970e0a93f691bdb7134f6cc2598e6d5aca63c1b (patch) | |
tree | 7f751ce299a1ae00ecaeca6b55fc58f783d5d74b | |
parent | 9748b8b9865515a5d0c9087a7fa4587f1abe4e5b (diff) | |
download | lua-cjson-5970e0a93f691bdb7134f6cc2598e6d5aca63c1b.tar.gz lua-cjson-5970e0a93f691bdb7134f6cc2598e6d5aca63c1b.tar.bz2 lua-cjson-5970e0a93f691bdb7134f6cc2598e6d5aca63c1b.zip |
Remove external VERSION #define for lua_cjson.c
The external #define complicates compilation but is only used in
lua_cjson.c and Makefile.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | lua-cjson-1.0.4-1.rockspec | 6 | ||||
-rw-r--r-- | lua_cjson.c | 6 |
3 files changed, 9 insertions, 5 deletions
@@ -45,7 +45,7 @@ INSTALL_CMD = install | |||
45 | 45 | ||
46 | ## End platform specific section | 46 | ## End platform specific section |
47 | 47 | ||
48 | BUILD_CFLAGS = -fpic -I$(LUA_INCLUDE_DIR) -DVERSION=\"$(CJSON_VERSION)\" $(CJSON_CFLAGS) | 48 | BUILD_CFLAGS = -fpic -I$(LUA_INCLUDE_DIR) $(CJSON_CFLAGS) |
49 | OBJS := lua_cjson.o strbuf.o | 49 | OBJS := lua_cjson.o strbuf.o |
50 | 50 | ||
51 | .PHONY: all clean install package doc | 51 | .PHONY: all clean install package doc |
diff --git a/lua-cjson-1.0.4-1.rockspec b/lua-cjson-1.0.4-1.rockspec index 5eac501..ee287b5 100644 --- a/lua-cjson-1.0.4-1.rockspec +++ b/lua-cjson-1.0.4-1.rockspec | |||
@@ -31,7 +31,7 @@ build = { | |||
31 | -- USE_INTERNAL_ISINF: Provide internal isinf() implementation. Required | 31 | -- USE_INTERNAL_ISINF: Provide internal isinf() implementation. Required |
32 | -- on some Solaris platforms. | 32 | -- on some Solaris platforms. |
33 | defines = { | 33 | defines = { |
34 | "VERSION=\"1.0.4\"", "USE_POSIX_SETLOCALE", | 34 | "USE_POSIX_SETLOCALE", |
35 | -- LuaRocks does not support platform specific configuration for Solaris. | 35 | -- LuaRocks does not support platform specific configuration for Solaris. |
36 | -- Uncomment the line below on Solaris platforms. | 36 | -- Uncomment the line below on Solaris platforms. |
37 | -- "USE_INTERNAL_ISINF" | 37 | -- "USE_INTERNAL_ISINF" |
@@ -41,10 +41,10 @@ build = { | |||
41 | -- Override default build options (per platform) | 41 | -- Override default build options (per platform) |
42 | platforms = { | 42 | platforms = { |
43 | linux = { modules = { cjson = { defines = { | 43 | linux = { modules = { cjson = { defines = { |
44 | [2] = "USE_POSIX_USELOCALE" | 44 | [1] = "USE_POSIX_USELOCALE" |
45 | } } } }, | 45 | } } } }, |
46 | macosx = { modules = { cjson = { defines = { | 46 | macosx = { modules = { cjson = { defines = { |
47 | [2] = "USE_POSIX_USELOCALE" | 47 | [1] = "USE_POSIX_USELOCALE" |
48 | } } } } | 48 | } } } } |
49 | }, | 49 | }, |
50 | copy_directories = { "tests" } | 50 | copy_directories = { "tests" } |
diff --git a/lua_cjson.c b/lua_cjson.c index 806a67c..24fb13d 100644 --- a/lua_cjson.c +++ b/lua_cjson.c | |||
@@ -44,6 +44,10 @@ | |||
44 | 44 | ||
45 | #include "strbuf.h" | 45 | #include "strbuf.h" |
46 | 46 | ||
47 | #ifndef CJSON_VERSION | ||
48 | #define CJSON_VERSION "1.0.4" | ||
49 | #endif | ||
50 | |||
47 | /* Support to reset locale to POSIX for strtod() / sprintf(). | 51 | /* Support to reset locale to POSIX for strtod() / sprintf(). |
48 | * Some locales use comma as a decimal separator. This breaks JSON. */ | 52 | * Some locales use comma as a decimal separator. This breaks JSON. */ |
49 | #ifdef USE_POSIX_USELOCALE | 53 | #ifdef USE_POSIX_USELOCALE |
@@ -1338,7 +1342,7 @@ int luaopen_cjson(lua_State *l) | |||
1338 | lua_setfield(l, -2, "null"); | 1342 | lua_setfield(l, -2, "null"); |
1339 | 1343 | ||
1340 | /* Set cjson.version */ | 1344 | /* Set cjson.version */ |
1341 | lua_pushliteral(l, VERSION); | 1345 | lua_pushliteral(l, CJSON_VERSION); |
1342 | lua_setfield(l, -2, "version"); | 1346 | lua_setfield(l, -2, "version"); |
1343 | 1347 | ||
1344 | /* Return cjson table */ | 1348 | /* Return cjson table */ |