From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp34.i.mail.ru (smtp34.i.mail.ru [94.100.177.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 1CFCE469710 for ; Tue, 19 May 2020 23:48:17 +0300 (MSK) References: <9dd79b8d7c37a9ff60e4c7abcde81c5cf5b4e5f6.1589240704.git.v.shpilevoy@tarantool.org> <20200513210633.GA18509@tarantool.org> <5c933d26-cda8-81e1-30f6-3547a4629b31@tarantool.org> <20200514022428.GD18509@tarantool.org> <20200519121148.v4fiwv65by3tbpc2@tkn_work_nb> From: Vladislav Shpilevoy Message-ID: <2d44088e-fa1c-839e-a205-d47ae9b8409e@tarantool.org> Date: Tue, 19 May 2020 22:48:15 +0200 MIME-Version: 1.0 In-Reply-To: <20200519121148.v4fiwv65by3tbpc2@tkn_work_nb> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 5/5] msgpuck: activate MP_EXT custom serializers List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Turenko Cc: tarantool-patches@dev.tarantool.org Thanks for the review! On 19/05/2020 14:11, Alexander Turenko wrote: >> diff --git a/src/box/msgpack.c b/src/box/msgpack.c >> index 37bb3920c..4013aec4c 100644 >> --- a/src/box/msgpack.c >> +++ b/src/box/msgpack.c >> @@ -49,7 +49,8 @@ msgpack_fprint_ext(FILE *file, const char **data, int depth) >> case MP_ERROR: >> return mp_fprint_error(file, data, depth); >> default: >> - return fprintf(file, "undefined"); >> + return fprintf(file, "(extension: type %d, len %u)", (int)type, >> + (unsigned)len); >> } >> } > > I would reuse mp_fprint_ext_default() here. It will decode MP_EXT again, I wanted to avoid this. But I guess perf is not so critical here, yeah. ==================== diff --git a/src/box/msgpack.c b/src/box/msgpack.c index 4013aec4c..1723dea4c 100644 --- a/src/box/msgpack.c +++ b/src/box/msgpack.c @@ -39,6 +39,7 @@ static int msgpack_fprint_ext(FILE *file, const char **data, int depth) { + const char **orig = data; int8_t type; uint32_t len = mp_decode_extl(data, &type); switch(type) { @@ -49,14 +50,14 @@ msgpack_fprint_ext(FILE *file, const char **data, int depth) case MP_ERROR: return mp_fprint_error(file, data, depth); default: - return fprintf(file, "(extension: type %d, len %u)", (int)type, - (unsigned)len); + return mp_fprint_ext_default(file, orig, depth); } } static int msgpack_snprint_ext(char *buf, int size, const char **data, int depth) { + const char **orig = data; int8_t type; uint32_t len = mp_decode_extl(data, &type); switch(type) { @@ -67,8 +68,7 @@ msgpack_snprint_ext(char *buf, int size, const char **data, int depth) case MP_ERROR: return mp_snprint_error(buf, size, data, depth); default: - return snprintf(buf, size, "(extension: type %d, len %u)", - (int)type, (unsigned)len); + return mp_snprint_ext_default(buf, size, orig, depth); } }