From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: [tarantool-patches] [PATCH v3 4/7] lib: update msgpuck library References: From: Kirill Shcherbatov Message-ID: Date: Wed, 3 Apr 2019 20:49:21 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit To: tarantool-patches@freelists.org, Vladimir Davydov List-ID: Due to changes in the mp_stack API class, we must also fix tuple_format.c In order not to change this code twice, the patch was moved to the position subsequent iterator introduction. Now this is [6/7] patch in patchset. On the branch. ================================================ 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/lib/msgpuck | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) 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) { - 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); struct json_token token; - switch (mp_stack_type(&it->stack)) { + switch (frame->type) { case MP_ARRAY: rc = 1; token.type = JSON_TOKEN_NUM; - token.num = idx; + token.num = frame->idx; break; case MP_MAP: rc = 2; diff --git a/src/lib/msgpuck b/src/lib/msgpuck index 222b71aa6..4166d0f77 160000 --- a/src/lib/msgpuck +++ b/src/lib/msgpuck @@ -1 +1 @@ -Subproject commit 222b71aa63e8de6d0015588442d828460560d9be +Subproject commit 4166d0f77496040bcd595d5b02bbf17e7fac5d28 -- 2.21.0