From 92cebdcc374a7bb4bf59e1186076433e45cc1138 Mon Sep 17 00:00:00 2001 From: Datong Sun Date: Thu, 13 Jan 2022 08:47:48 +0800 Subject: bugfix: empty_array can not work on Apple because csjon did not compare light userdata address with masked address (#82) Since we used `json_lightudata_mask` when creating lightuserdata, same mask should be applied when comparing the return of `touserdata` Fixes #81. --- lua_cjson.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua_cjson.c') diff --git a/lua_cjson.c b/lua_cjson.c index ff61c47..df1794b 100644 --- a/lua_cjson.c +++ b/lua_cjson.c @@ -800,7 +800,7 @@ static void json_append_data(lua_State *l, json_config_t *cfg, case LUA_TLIGHTUSERDATA: if (lua_touserdata(l, -1) == NULL) { strbuf_append_mem(json, "null", 4); - } else if (lua_touserdata(l, -1) == &json_array) { + } else if (lua_touserdata(l, -1) == json_lightudata_mask(&json_array)) { json_append_array(l, cfg, current_depth, json, 0); } break; -- cgit v1.2.3-55-g6feb