From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sun, 7 Apr 2019 15:22:25 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] Re: [PATCH v3 4/7] lib: update msgpuck library Message-ID: <20190407122225.bmufshoojlqjgor7@esperanza> References: <20190404155433.6abpuiwakrxjyktg@esperanza> <58a0a5ad-1293-eb8f-704b-88e7ef1961e4@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <58a0a5ad-1293-eb8f-704b-88e7ef1961e4@tarantool.org> To: Kirill Shcherbatov Cc: tarantool-patches@freelists.org List-ID: On Fri, Apr 05, 2019 at 08:17:25PM +0300, Kirill Shcherbatov wrote: > The msgpack dependency has been updated because the new version > introduces the new method mp_stack_top for the mp_stack class > which we will use to store a pointer for a multikey frame to > initialize a field_map in case of multikey index. > > As the library API has changed, the code has been modified > correspondingly. > > Needed for #1012 > --- > src/box/tuple_format.c | 9 +++++---- > src/box/vy_stmt.c | 8 ++++---- > src/lib/msgpuck | 2 +- > 3 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c > index 1043707ad..093046b37 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_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; > } > /* > @@ -871,10 +872,10 @@ tuple_field_map_create(struct tuple_format *format, const char *tuple, > * for the subsequent format::fields lookup. > */ > struct json_token token; > - switch (mp_stack_type(&stack)) { > + switch (frame->type) { > case MP_ARRAY: > token.type = JSON_TOKEN_NUM; > - token.num = idx; > + token.num = frame->idx; > break; > case MP_MAP: > if (mp_typeof(*pos) != MP_STR) { > diff --git a/src/box/vy_stmt.c b/src/box/vy_stmt.c > index 7387d72be..776b1f69c 100644 > --- a/src/box/vy_stmt.c > +++ b/src/box/vy_stmt.c > @@ -447,18 +447,18 @@ vy_stmt_new_surrogate_delete_raw(struct tuple_format *format, > struct tuple_field *field; > struct json_token *parent = &format->fields.root; > while (true) { > - int idx; > - while ((idx = mp_stack_advance(&stack)) == -1) { > + struct mp_frame *frame = mp_stack_top(&stack); > + while (!mp_frame_advance(frame)) { > mp_stack_pop(&stack); > if (mp_stack_is_empty(&stack)) > goto finish; > parent = parent->parent; mp_stack_top is missing! This result in assertion failure in engine/json. Looks like you didn't bother to run tests before submitting the patch. Fixed and pushed to master. > } > struct json_token token; > - switch (mp_stack_type(&stack)) { > + switch (frame->type) { > case MP_ARRAY: > token.type = JSON_TOKEN_NUM; > - token.num = idx; > + token.num = frame->idx; > break; > case MP_MAP: > if (mp_typeof(*src_pos) != MP_STR) {