[Tarantool-patches] [PATCH 5/5] msgpuck: activate MP_EXT custom serializers
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Tue May 19 23:48:15 MSK 2020
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);
}
}
More information about the Tarantool-patches
mailing list