diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2016-12-16 12:32:56 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2016-12-16 12:32:56 +0400 |
commit | e5377be211692e3f2a6f2add24dcb83f316f8154 (patch) | |
tree | 4e493d47467cfb3fb353c89a70098a8eecbf258a /include/json_lib.h | |
parent | 8938031bc7eb78d406553465341338038cfb2e1a (diff) | |
download | mariadb-git-e5377be211692e3f2a6f2add24dcb83f316f8154.tar.gz |
MDEV-11562 Assertion `js->state == JST_VALUE' failed in check_contains(json_engine_t*, json_engine_t*).
check_contains() fixed. When an item of an array is a complex
structure, it can be half-read after the end of the recursive
check_contains() call. So we just manually get to it's ending.
Diffstat (limited to 'include/json_lib.h')
-rw-r--r-- | include/json_lib.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/include/json_lib.h b/include/json_lib.h index b26d865fd36..ce7f27317bc 100644 --- a/include/json_lib.h +++ b/include/json_lib.h @@ -295,13 +295,27 @@ int json_read_value(json_engine_t *j); int json_skip_key(json_engine_t *j); +typedef const int *json_level_t; + +/* + json_skip_to_level() makes parser quickly get out of nested + loops and arrays. It is used when we're not interested in what is + there in the rest of these structures. + The 'level' should be remembered in advance. + json_level_t level= json_get_level(j); + .... // getting into the nested JSON structures + json_skip_to_level(j, level); +*/ +#define json_get_level(j) (j->stack_p) + +int json_skip_to_level(json_engine_t *j, json_level_t level); + /* - json_skip_level() makes parser quickly skip the JSON content - to the end of the current object or array. - It is used when we're not interested in the rest of an array - or the rest of the keys of an object. + json_skip_level() works as above with just current structre. + So it gets to the end of the current JSON array or object. */ -int json_skip_level(json_engine_t *j); +#define json_skip_level(json_engine) \ + json_skip_to_level((json_engine), (json_engine)->stack_p) #define json_skip_array_item json_skip_key |