From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id BFB416EC55; Thu, 29 Jul 2021 14:41:49 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BFB416EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1627558909; bh=lRfDzsDNUeYwugn1D9ST5Nj+OUp1alIGd6CFMrSn0Bw=; h=In-Reply-To:Date:References:To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=H4KmpWNycal3rkPHi7KkBHlXHhXoGfpShXMQ46a7UCGy9hgvv4KWci/LyCOaUQdkH 9qtI/xcOnHDgRGlBxovdm0n9kZPJF35CDhIgQ2vbZYoHjHlTBhADDEipBovoDjXi7Y MCKFjhkr/TyCnBqg3k1gmYo1OJCxR2a8IMVvKpho= Received: from smtp32.i.mail.ru (smtp32.i.mail.ru [94.100.177.92]) (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 F21836EC55 for ; Thu, 29 Jul 2021 14:41:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F21836EC55 Received: by smtp32.i.mail.ru with esmtpa (envelope-from ) id 1m94Q8-000305-4U; Thu, 29 Jul 2021 14:41:48 +0300 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) In-Reply-To: <9fa0fdfa9ef6075dc14acf40040f7ed0e2f6c7e2.1627420835.git.v.shpilevoy@tarantool.org> Date: Thu, 29 Jul 2021 14:41:46 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <628F0905-361D-4DBE-9CC9-968698105242@tarantool.org> References: <9fa0fdfa9ef6075dc14acf40040f7ed0e2f6c7e2.1627420835.git.v.shpilevoy@tarantool.org> To: Vladislav Shpilevoy X-Mailer: Apple Mail (2.3654.100.0.2.22) X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD941C43E597735A9C351B198F4576AC7B2770D7874BA03B4AE182A05F538085040B987E4DCFE0FCE06542A08FD41339FA80E51BEB69FDECD5B0564F704BA246426 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7DB7B102DCB413779EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D0EEADB0B77E68768638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D86FE00D9B0A4DC5DFD0A9A275661EF5FA117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC8C7ADC89C2F0B2A5A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18CB629EEF1311BF91D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B67393CE827C55B5F775ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5DD3CCA585A77C86B5726C078B20DA82E12E8E3CE238FD9BDD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA753530422897FB34C3410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D346F8291983715AC667BBECFE3006DE1A9C11DAC15048D822F1D4A346B4E3A6ECF9301D396833D08321D7E09C32AA3244C72C2DDD3466BA10527BABFD45B234A5B408A6A02710B7304FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojPp/mPgZxawF2R50yGcGsVw== X-Mailru-Sender: 3B9A0136629DC912F4AABCEFC589C81EAFCF2815D07B9543496075C24EAE09F833762C596EDE2BB8AD07DD1419AC565FA614486B47F28B67C5E079CCF3B0523AED31B7EB2E253A9E112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 3/5] decimal: rename decimal_to_string to decimal_str X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Ostanevich via Tarantool-patches Reply-To: Sergey Ostanevich Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for the patch, just one comment re commit message. LGTM Sergos > On 28 Jul 2021, at 00:24, Vladislav Shpilevoy = wrote: >=20 > To be consistent with tt_uuid_str() and tt_uuid_to_string(). > _str() returns a string. _to_string() copies it into an externally > passed buffer. Please, mention the decimal_to_string() function explicitly to ease the = search later on. >=20 > Part of #6259 > --- > src/box/lua/serialize_lua.c | 2 +- > src/lib/core/decimal.c | 2 +- > src/lib/core/decimal.h | 2 +- > src/lib/core/mp_decimal.c | 4 ++-- > src/lua/decimal.c | 2 +- > test/unit/decimal.c | 4 ++-- > third_party/lua-cjson/lua_cjson.c | 2 +- > third_party/lua-yaml/lyaml.cc | 2 +- > 8 files changed, 10 insertions(+), 10 deletions(-) >=20 > diff --git a/src/box/lua/serialize_lua.c b/src/box/lua/serialize_lua.c > index 7144305cf..1f791980f 100644 > --- a/src/box/lua/serialize_lua.c > +++ b/src/box/lua/serialize_lua.c > @@ -853,7 +853,7 @@ dump_node(struct lua_dumper *d, struct node *nd, = int indent) > switch (field->ext_type) { > case MP_DECIMAL: > nd->mask |=3D NODE_QUOTE; > - str =3D decimal_to_string(field->decval); > + str =3D decimal_str(field->decval); > len =3D strlen(str); > break; > case MP_UUID: > diff --git a/src/lib/core/decimal.c b/src/lib/core/decimal.c > index 118c311d5..4befbda37 100644 > --- a/src/lib/core/decimal.c > +++ b/src/lib/core/decimal.c > @@ -165,7 +165,7 @@ decimal_from_uint64(decimal_t *dec, uint64_t num) > } >=20 > const char * > -decimal_to_string(const decimal_t *dec) > +decimal_str(const decimal_t *dec) > { > char *buf =3D tt_static_buf(); > /* No errors are possible. */ > diff --git a/src/lib/core/decimal.h b/src/lib/core/decimal.h > index 6f8762ed3..d2f2dfbdb 100644 > --- a/src/lib/core/decimal.h > +++ b/src/lib/core/decimal.h > @@ -126,7 +126,7 @@ decimal_from_uint64(decimal_t *dec, uint64_t num); > * the decimal representation. > */ > const char * > -decimal_to_string(const decimal_t *dec); > +decimal_str(const decimal_t *dec); >=20 > /** > * Convert a given decimal to int64_t > diff --git a/src/lib/core/mp_decimal.c b/src/lib/core/mp_decimal.c > index ffc2c5773..3610b8af5 100644 > --- a/src/lib/core/mp_decimal.c > +++ b/src/lib/core/mp_decimal.c > @@ -77,7 +77,7 @@ mp_snprint_decimal(char *buf, int size, const char = **data, uint32_t len) > decimal_t d; > if (decimal_unpack(data, len, &d) =3D=3D NULL) > return -1; > - return snprintf(buf, size, "%s", decimal_to_string(&d)); > + return snprintf(buf, size, "%s", decimal_str(&d)); > } >=20 > int > @@ -86,5 +86,5 @@ mp_fprint_decimal(FILE *file, const char **data, = uint32_t len) > decimal_t d; > if (decimal_unpack(data, len, &d) =3D=3D NULL) > return -1; > - return fprintf(file, "%s", decimal_to_string(&d)); > + return fprintf(file, "%s", decimal_str(&d)); > } > diff --git a/src/lua/decimal.c b/src/lua/decimal.c > index 003680a48..e25b3ec18 100644 > --- a/src/lua/decimal.c > +++ b/src/lua/decimal.c > @@ -376,7 +376,7 @@ ldecimal_tostring(struct lua_State *L) > if (lua_gettop(L) < 1) > return luaL_error(L, "usage: = decimal.tostring(decimal)"); > decimal_t *lhs =3D lua_checkdecimal(L, 1); > - lua_pushstring(L, decimal_to_string(lhs)); > + lua_pushstring(L, decimal_str(lhs)); > return 1; > } >=20 > diff --git a/test/unit/decimal.c b/test/unit/decimal.c > index 32694b88a..756c68518 100644 > --- a/test/unit/decimal.c > +++ b/test/unit/decimal.c > @@ -107,7 +107,7 @@ char buf[32]; > is(b1, b2, "mp_decode(mp_encode("str") len");\ > is(decimal_compare(&dec, &d2), 0, "mp_decode(mp_encode("str")) = value");\ > is(decimal_scale(&dec), decimal_scale(&d2), = "mp_decode(mp_encode("str")) scale");\ > - is(strcmp(decimal_to_string(&d2), str), 0, = "str(mp_decode(mp_encode("str"))) =3D=3D "str);\ > + is(strcmp(decimal_str(&d2), str), 0, = "str(mp_decode(mp_encode("str"))) =3D=3D "str);\ > b2 =3D buf;\ > int8_t type;\ > uint32_t l2 =3D mp_decode_extl(&b2, &type);\ > @@ -131,7 +131,7 @@ char buf[32]; > is(decimal_compare(&dec, &d2), 0, = "decimal_unpack(decimal_pack("str")) value");\ > is(decimal_scale(&dec), decimal_scale(&d2), = "decimal_unpack(decimal_pack("str")) scale");\ > is(decimal_precision(&dec), decimal_precision(&d2), = "decimal_unpack(decimal_pack("str")) precision");\ > - is(strcmp(decimal_to_string(&d2), str), 0, = "str(decimal_unpack(decimal_pack("str")) =3D=3D "str);\ > + is(strcmp(decimal_str(&d2), str), 0, = "str(decimal_unpack(decimal_pack("str")) =3D=3D "str);\ > }) >=20 > #define test_toint(type, num, out_fmt) ({\ > diff --git a/third_party/lua-cjson/lua_cjson.c = b/third_party/lua-cjson/lua_cjson.c > index 5123b9a74..7a326075a 100644 > --- a/third_party/lua-cjson/lua_cjson.c > +++ b/third_party/lua-cjson/lua_cjson.c > @@ -420,7 +420,7 @@ static void json_append_data(lua_State *l, struct = luaL_serializer *cfg, > switch (field.ext_type) { > case MP_DECIMAL: > { > - const char *str =3D decimal_to_string(field.decval); > + const char *str =3D decimal_str(field.decval); > return json_append_string(cfg, json, str, strlen(str)); > } > case MP_UUID: > diff --git a/third_party/lua-yaml/lyaml.cc = b/third_party/lua-yaml/lyaml.cc > index 5469e9f4f..2b67dcc6a 100644 > --- a/third_party/lua-yaml/lyaml.cc > +++ b/third_party/lua-yaml/lyaml.cc > @@ -700,7 +700,7 @@ static int dump_node(struct lua_yaml_dumper = *dumper) > case MP_EXT: > switch (field.ext_type) { > case MP_DECIMAL: > - str =3D decimal_to_string(field.decval); > + str =3D decimal_str(field.decval); > len =3D strlen(str); > break; > case MP_UUID: > --=20 > 2.24.3 (Apple Git-128) >=20