Skip to content

Commit e06e123

Browse files
committed
Update JSON parser.
1 parent f46f02c commit e06e123

2 files changed

Lines changed: 6 additions & 16 deletions

File tree

src/util/json_parser.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,12 @@ static int __json_isdigit(char c)
8686
#define isdigit(c) __json_isdigit(c)
8787

8888
static const int __character_map[256] = {
89-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
90-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
91-
1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
92-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
93-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
94-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
95-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
96-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
97-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
9889
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
9990
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
100-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
101-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
102-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
103-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
104-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
91+
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
92+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
93+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
94+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
10595
};
10696

10797
static int __json_string_length(const char *cursor, size_t *escape, size_t *len)
@@ -111,7 +101,7 @@ static int __json_string_length(const char *cursor, size_t *escape, size_t *len)
111101

112102
while (1)
113103
{
114-
while (__character_map[(unsigned char)cursor[n]])
104+
while (__character_map[(unsigned char)cursor[n]] == 0)
115105
n++;
116106

117107
if (cursor[n] == '\"')

src/util/json_parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extern "C"
3838
{
3939
#endif
4040

41-
json_value_t *json_value_parse(const char *json);
41+
json_value_t *json_value_parse(const char *text);
4242
json_value_t *json_value_create(int type, ...);
4343
json_value_t *json_value_copy(const json_value_t *val);
4444
void json_value_destroy(json_value_t *val);

0 commit comments

Comments
 (0)