diff --git a/src/util/json_parser.c b/src/util/json_parser.c index c7d43c79..d9fe1a7d 100644 --- a/src/util/json_parser.c +++ b/src/util/json_parser.c @@ -86,22 +86,12 @@ static int __json_isdigit(char c) #define isdigit(c) __json_isdigit(c) static const int __character_map[256] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, }; 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) while (1) { - while (__character_map[(unsigned char)cursor[n]]) + while (__character_map[(unsigned char)cursor[n]] == 0) n++; if (cursor[n] == '\"') diff --git a/src/util/json_parser.h b/src/util/json_parser.h index 7bb2837a..dfad0053 100644 --- a/src/util/json_parser.h +++ b/src/util/json_parser.h @@ -38,7 +38,7 @@ extern "C" { #endif -json_value_t *json_value_parse(const char *json); +json_value_t *json_value_parse(const char *text); json_value_t *json_value_create(int type, ...); json_value_t *json_value_copy(const json_value_t *val); void json_value_destroy(json_value_t *val);