From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 10 Dec 2018 20:34:00 +0300 From: Vladimir Davydov Subject: Re: [PATCH v6 1/4] lib: make index_base support for json_lexer Message-ID: <20181210173400.7gbaoaljkemp7for@esperanza> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: To: Kirill Shcherbatov Cc: tarantool-patches@freelists.org, kostja@tarantool.org List-ID: 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.