mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-05 02:38:31 +00:00
Rename ParseJson() to DecodeJson() for consistency
This commit is contained in:
parent
28f0104330
commit
e4d6e263d4
5 changed files with 52 additions and 52 deletions
|
@ -673,7 +673,7 @@ FUNCTIONS
|
|||
URIs that do things like embed a PNG file in a web page. See
|
||||
encodebase64.c.
|
||||
|
||||
ParseJson(input:str)
|
||||
DecodeJson(input:str)
|
||||
├─→ value:*
|
||||
└─→ nil, error:str
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ static struct Rc Parse(struct lua_State *L, const char *p, const char *e) {
|
|||
* @param n is byte length of `p` or -1 for automatic strlen()
|
||||
* @return 1 if value was pushed, 0 on end, or -1 on error
|
||||
*/
|
||||
int ParseJson(struct lua_State *L, const char *p, size_t n) {
|
||||
int DecodeJson(struct lua_State *L, const char *p, size_t n) {
|
||||
if (n == -1) n = p ? strlen(p) : 0;
|
||||
return Parse(L, p, p + n).t;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
int ParseJson(struct lua_State *, const char *, size_t);
|
||||
int DecodeJson(struct lua_State *, const char *, size_t);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
|
|
@ -146,7 +146,7 @@ STATIC_YOINK("ShowCrashReportsEarly");
|
|||
#define REDBEAN "redbean"
|
||||
#endif
|
||||
|
||||
#define VERSION 0x02000a
|
||||
#define VERSION 0x02000b
|
||||
#define HEARTBEAT 5000 /*ms*/
|
||||
#define HASH_LOAD_FACTOR /* 1. / */ 4
|
||||
#define MONITOR_MICROS 150000
|
||||
|
@ -4259,11 +4259,11 @@ static int LuaEncodeLua(lua_State *L) {
|
|||
return LuaEncodeSmth(L, LuaEncodeLuaData);
|
||||
}
|
||||
|
||||
static int LuaParseJson(lua_State *L) {
|
||||
static int LuaDecodeJson(lua_State *L) {
|
||||
size_t n;
|
||||
const char *p;
|
||||
p = luaL_checklstring(L, 1, &n);
|
||||
return ParseJson(L, p, n);
|
||||
return DecodeJson(L, p, n);
|
||||
}
|
||||
|
||||
static int LuaGetUrl(lua_State *L) {
|
||||
|
@ -5072,6 +5072,7 @@ static const luaL_Reg kLuaFuncs[] = {
|
|||
{"Crc32c", LuaCrc32c}, //
|
||||
{"Decimate", LuaDecimate}, //
|
||||
{"DecodeBase64", LuaDecodeBase64}, //
|
||||
{"DecodeJson", LuaDecodeJson}, //
|
||||
{"DecodeLatin1", LuaDecodeLatin1}, //
|
||||
{"Deflate", LuaDeflate}, //
|
||||
{"EncodeBase64", LuaEncodeBase64}, //
|
||||
|
@ -5158,7 +5159,6 @@ static const luaL_Reg kLuaFuncs[] = {
|
|||
{"ParseHost", LuaParseHost}, //
|
||||
{"ParseHttpDateTime", LuaParseHttpDateTime}, //
|
||||
{"ParseIp", LuaParseIp}, //
|
||||
{"ParseJson", LuaParseJson}, //
|
||||
{"ParseParams", LuaParseParams}, //
|
||||
{"ParseUrl", LuaParseUrl}, //
|
||||
{"Popcnt", LuaPopcnt}, //
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue