From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 4 Apr 2019 18:54:33 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] [PATCH v3 4/7] lib: update msgpuck library Message-ID: <20190404155433.6abpuiwakrxjyktg@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 List-ID: On Wed, Apr 03, 2019 at 08:49:21PM +0300, Kirill Shcherbatov wrote: > diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c > index 9a643b700..7cfdd73bc 100644 > --- a/src/box/tuple_format.c > +++ b/src/box/tuple_format.c > @@ -974,8 +974,8 @@ tuple_parse_iterator_advice(struct tuple_parse_iterator *it, > struct tuple_field **field, const char **data, > const char **data_end) Once you figure out why msgpuck build failed on Travis (see my other email), please rebase this patch on top of the master branch so that we can push it right away. > { > - int idx, rc = 0; > - while ((idx = mp_stack_advance(&it->stack)) == -1) { > + int rc = 0; > + while (!mp_frame_advance(mp_stack_top(&it->stack))) { > /* > * If the elements of the current frame > * are over, pop this frame out of stack > @@ -993,12 +993,13 @@ tuple_parse_iterator_advice(struct tuple_parse_iterator *it, > * current data offset to prepare the JSON token > * for the subsequent format::fields lookup. > */ > + struct mp_frame *frame = mp_stack_top(&it->stack); Can we please refactor it a little so that we don't call mp_stack_top twice in case the frame is advanced? diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c index 1043707a..d3c82a7a 100644 --- a/src/box/tuple_format.c +++ b/src/box/tuple_format.c @@ -850,8 +850,8 @@ tuple_field_map_create(struct tuple_format *format, const char *tuple, struct tuple_field *field; struct json_token *parent = &format->fields.root; while (true) { - int idx; - while ((idx = mp_stack_advance(&stack)) == -1) { + struct mp_stack_frame *frame = mp_stack_top(&stack); + while (!mp_frame_advance(frame)) { /* * If the elements of the current frame * are over, pop this frame out of stack @@ -863,6 +863,7 @@ tuple_field_map_create(struct tuple_format *format, const char *tuple, mp_stack_pop(&stack); if (mp_stack_is_empty(&stack)) goto finish; + frame = mp_stack_top(&stack); parent = parent->parent; } /*