[PATCH v6 1/4] lib: make index_base support for json_lexer
Vladimir Davydov
vdavydov.dev at gmail.com
Mon Dec 10 20:34:00 MSK 2018
On Thu, Dec 06, 2018 at 11:42:28AM +0300, Kirill Shcherbatov wrote:
> Introduced a new index_base field for json_lexer class - this
> value is a base field offset for emitted JSON_TOKEN_NUM tokens.
> Thus, we get rid of the need to perform manual casts using the
> TUPLE_INDEX_BASE constant in the majority of cases. This will
> also ensure that the extracted tuples are correctly inserted
> into the numerical level of JSON tree.
>
> Needed for #1012
> diff --git a/src/lib/json/json.h b/src/lib/json/json.h
> index ead446878..5c8d973e5 100644
> --- a/src/lib/json/json.h
> +++ b/src/lib/json/json.h
> @@ -49,6 +49,11 @@ struct json_lexer {
> int offset;
> /** Current lexer's offset in symbols. */
> int symbol_count;
> + /**
> + * Base field offset for emitted JSON_TOKEN_NUM tokens,
> + * e.g. 0 for C and 1 for Lua.
> + */
> + unsigned index_base;
I changed the type of this member to int, as we use int in
tuple_update_execute(), and pushed it to 2.1.
More information about the Tarantool-patches
mailing list