Created
June 15, 2020 21:42
-
-
Save un-def/d6b97f5ef6b47edda7f65e0c6144663c to your computer and use it in GitHub Desktop.
lua-cmsgpack patch for null values in hash tables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package = "lua-cmsgpack" | |
version = "0.4.0-0" | |
source = { | |
url = "git://github.com/antirez/lua-cmsgpack.git", | |
tag = "0.4.0" | |
} | |
description = { | |
summary = "MessagePack C implementation and bindings for Lua 5.1/5.2/5.3", | |
homepage = "http://github.com/antirez/lua-cmsgpack", | |
license = "Two-clause BSD", | |
maintainer = "Salvatore Sanfilippo <[email protected]>" | |
} | |
dependencies = { | |
"lua >= 5.1" | |
} | |
build = { | |
type = "builtin", | |
modules = { | |
cmsgpack = { | |
sources = { | |
"lua_cmsgpack.c" | |
} | |
} | |
}, | |
patches = { | |
["null_values_in_hash.patch"] = [[ | |
--- a/lua_cmsgpack.c | |
+++ b/lua_cmsgpack.c | |
@@ -565,6 +565,10 @@ void mp_decode_to_lua_hash(lua_State *L, mp_cur *c, size_t len) { | |
mp_decode_to_lua_type(L,c); /* key */ | |
if (c->err) return; | |
mp_decode_to_lua_type(L,c); /* value */ | |
+ if (lua_isnil(L, -1)) { | |
+ lua_pop(L, 1); | |
+ lua_pushlightuserdata(L, NULL); | |
+ } | |
if (c->err) return; | |
lua_settable(L,-3); | |
} | |
]] | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lua_cmsgpack.c b/lua_cmsgpack.c | |
index 0b82d00..1df6505 100644 | |
--- a/lua_cmsgpack.c | |
+++ b/lua_cmsgpack.c | |
@@ -565,6 +565,10 @@ void mp_decode_to_lua_hash(lua_State *L, mp_cur *c, size_t len) { | |
mp_decode_to_lua_type(L,c); /* key */ | |
if (c->err) return; | |
mp_decode_to_lua_type(L,c); /* value */ | |
+ if (lua_isnil(L, -1)) { | |
+ lua_pop(L, 1); | |
+ lua_pushlightuserdata(L, NULL); | |
+ } | |
if (c->err) return; | |
lua_settable(L,-3); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment