diff options
| author | Yichun Zhang (agentzh) <agentzh@gmail.com> | 2017-11-17 13:31:16 -0800 |
|---|---|---|
| committer | Yichun Zhang (agentzh) <agentzh@gmail.com> | 2017-11-17 13:31:16 -0800 |
| commit | bcbbb53bf2066c64614127f361e158970a14cab2 (patch) | |
| tree | d66bbe1fbfc01185d168909f72d1ddd2c3b6c30f | |
| parent | b5e364c7c60167995944ed3a3b9c54d9a377fc1d (diff) | |
| download | lua-cjson-bcbbb53bf2066c64614127f361e158970a14cab2.tar.gz lua-cjson-bcbbb53bf2066c64614127f361e158970a14cab2.tar.bz2 lua-cjson-bcbbb53bf2066c64614127f361e158970a14cab2.zip | |
bugfix: fixed the C compiler warning "SO C90 forbids mixed declarations and code" on older operating systems.2.1.0.6rc2
| -rw-r--r-- | lua_cjson.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lua_cjson.c b/lua_cjson.c index 6c7eb4e..c0bdce1 100644 --- a/lua_cjson.c +++ b/lua_cjson.c | |||
| @@ -710,6 +710,8 @@ static void json_append_data(lua_State *l, json_config_t *cfg, | |||
| 710 | int current_depth, strbuf_t *json) | 710 | int current_depth, strbuf_t *json) |
| 711 | { | 711 | { |
| 712 | int len; | 712 | int len; |
| 713 | int as_array = 0; | ||
| 714 | int has_metatable; | ||
| 713 | 715 | ||
| 714 | switch (lua_type(l, -1)) { | 716 | switch (lua_type(l, -1)) { |
| 715 | case LUA_TSTRING: | 717 | case LUA_TSTRING: |
| @@ -728,8 +730,7 @@ static void json_append_data(lua_State *l, json_config_t *cfg, | |||
| 728 | current_depth++; | 730 | current_depth++; |
| 729 | json_check_encode_depth(l, cfg, current_depth, json); | 731 | json_check_encode_depth(l, cfg, current_depth, json); |
| 730 | 732 | ||
| 731 | int as_array = 0; | 733 | has_metatable = lua_getmetatable(l, -1); |
| 732 | int has_metatable = lua_getmetatable(l, -1); | ||
| 733 | 734 | ||
| 734 | if (has_metatable) { | 735 | if (has_metatable) { |
| 735 | lua_pushlightuserdata(l, &json_array); | 736 | lua_pushlightuserdata(l, &json_array); |
