mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 00:02:28 +00:00
Simplify the redbean JSON encoder
This commit is contained in:
parent
2d1731b995
commit
e4b559c76a
2 changed files with 17 additions and 23 deletions
5
third_party/lua/luaencodeluadata.c
vendored
5
third_party/lua/luaencodeluadata.c
vendored
|
@ -130,6 +130,7 @@ static int LuaEncodeLuaDataImpl(lua_State *L, char **buf, int level,
|
|||
fmt[4] = *numformat;
|
||||
break;
|
||||
default:
|
||||
free(visited->p);
|
||||
luaL_error(L, "numformat string not allowed");
|
||||
unreachable;
|
||||
}
|
||||
|
@ -178,12 +179,12 @@ static int LuaEncodeLuaDataImpl(lua_State *L, char **buf, int level,
|
|||
return 0;
|
||||
|
||||
default:
|
||||
// TODO(jart): don't leak memory with longjmp
|
||||
free(visited->p);
|
||||
luaL_error(L, "can't serialize value of this type");
|
||||
unreachable;
|
||||
}
|
||||
} else {
|
||||
// TODO(jart): don't leak memory with longjmp
|
||||
free(visited->p);
|
||||
luaL_error(L, "too many nested tables");
|
||||
unreachable;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue