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 2EDF56BD02; Tue, 30 Mar 2021 02:06:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2EDF56BD02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617059210; bh=/nd+SkMuHQJYVSK+sA8CZLrlXAqPm7bXKXKu+PZBHHc=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=TE+UMKVd3E3P9lXa9PHzgb+hxt/15G6zr67PHk9zdjyNMrBtHbw2EUBJaHZUZC53W qwBZIzfuKAt/2MLggoRROQqYhsYk2fMxIKXEKn2QgAiWk6sFKheWiUKxr5wXJuWZz7 FXr7suRF0XHE8s16ZFW4x1wia6GwSFL1R4BJCztM= Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 D29186BD09 for ; Tue, 30 Mar 2021 02:05:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D29186BD09 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lR0wQ-0001Zc-5o; Tue, 30 Mar 2021 02:05:02 +0300 To: imeevma@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: Message-ID: Date: Tue, 30 Mar 2021 01:05:01 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E32947427BE79D20CABD4F844F00D7AFD5C3C182A05F538085040FB1CE086D87BC8117286031BE4E1214929DA76F937372497FB71BBBF54EAB7B8 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE721B3E54BB37EA0B4EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063781C5E355D70FD85B8638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95CE99938B3FD79E1DFE2A2035AB62F9F94F2813DC7C1A3A6FEA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE71AE4D56B06699BBC9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C37EF884183F8E4D67117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD1A18204E546F3947C0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735444A83B712AC0148C4224003CC83647689D4C264860C145E X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831FB965E4CF9DE7C1FFCB540272E22000E X-C1DE0DAB: 0D63561A33F958A565D16F9D782E2F2E95FC12B697C5E290F9301F238FC89E40D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D343F22CE0A71FDB37E65BEB71E629A73C99EDCCA45650C3DC7C385E6897CFBEBF95B8FACA3635A87851D7E09C32AA3244C0B504CA12909313B9D45162F32369E15C3B3ADDA61883BB5FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojljIiQOC84rR9p0eapIhZjA== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638220F114E5A89FBC18ED3068619DDF4F9183841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v4 28/53] sql: refactor mem_set_*_string() 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for the patch! See 2 comments below. 1. I think it would be better to have mem_set_str_* as a prefix for these functions. 'string' is too long, and by placing allocation type in the beginning you complicate grep by mem_set_str_* and autocompletion when I type 'mem_set_str_' and want to see all the options. On 23.03.2021 10:35, Mergen Imeev via Tarantool-patches wrote: > This patch introduces mem_set_*_string() functions. Functions > mem_set_*_string() clears MEM and sets it to given string value. > > Part of #5818 > --- > src/box/sql/mem.c | 111 +++++++++++++++++++++++++++++++++--------- > src/box/sql/mem.h | 26 +++++++++- > src/box/sql/sqlInt.h | 4 -- > src/box/sql/vdbe.c | 5 +- > src/box/sql/vdbeapi.c | 47 ++++++++++++++---- > src/box/sql/vdbeaux.c | 45 +++++++---------- > 6 files changed, 171 insertions(+), 67 deletions(-) > > diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c > index 47a71fb30..91ef7f3c8 100644 > --- a/src/box/sql/mem.c > +++ b/src/box/sql/mem.c > @@ -2780,13 +2849,9 @@ vdbe_decode_msgpack_into_ephemeral_mem(const char *buf, struct Mem *mem, > break; > } > case MP_STR: { > - /* XXX u32->int */ > - mem->n = (int) mp_decode_strl(&buf); > - mem->flags = MEM_Str | MEM_Ephem; > - mem->field_type = FIELD_TYPE_STRING; > -install_blob: > - mem->z = (char *)buf; > - buf += mem->n; > + uint32_t len = mp_decode_strl(&buf); > + mem_set_ephemeral_string(mem, (char *)buf, len); 2. It adds clear() call which is not necessary here. I would propose to keep the old code for the sake of speed and consistency with the other mp types.