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 B44056EC5B; Tue, 30 Mar 2021 02:08:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B44056EC5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617059333; bh=YaaWfuutIpQqaFPqTQ33rCPufCYFIWbm2972eOIFTvc=; 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=Pa9GuXlaqQNpIB+ZlSlXftRwfpK81UsguWberSyLgah0EGH6P37GawAWYxLhqjt+u touMUAijO9UL18xb/fwQ84U4BU3wTSYx5gSaVl8LbIhoJPxLY4nVEZ0ZrfWKQGNJvy Kd3vVBQ/DtSAZkzpC0LO7PTzE3FPLPHY2HmkR8Wc= 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 D1EC46BD0D for ; Tue, 30 Mar 2021 02:05:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D1EC46BD0D Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lR0xH-00021R-2x; Tue, 30 Mar 2021 02:05:55 +0300 To: imeevma@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: Message-ID: <508fcec1-4dce-c19b-e0c1-c317e603798c@tarantool.org> Date: Tue, 30 Mar 2021 01:05:54 +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: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E32947A0146560F8BA709498CFB6209D8582A182A05F5380850406F9B6B323B5958A27D31B4AF235B0E81E7A059A4C2B9A4C6E6DBE91B40CD1746 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE754E958D11587BC68EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D07BBD2EBFB7BF888638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95CE99938B3FD79E1DF138AEA275E3CC1965C9F886E1ED9F925A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE78A0F7C24A37A3D769FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C39DB614F8F96CFA30117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD1A18204E546F3947C0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735444A83B712AC0148C4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A58E4B6D9BEBC6F1FB48823021AA8BC892D46ABB5524D21AF1D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D342B1F2AD168155B068FC2F53350599CFB131FDB9EFE2A08BF99F8BF6658DAC147ADC0B5A08E689F801D7E09C32AA3244CAD4EC738B57E2213C3AA19742AD38CF0F26BFA4C8A6946B8FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojljIiQOC84rSnSQrWVWEWHw== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638223AED50F6ED2F9068471A872BD44A7FA13841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v4 34/53] sql: introduce mem_set_*_map() and mem_set_*_array() 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! > diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c > index 7885caaf5..583de00a2 100644 > --- a/src/box/sql/mem.c > +++ b/src/box/sql/mem.c > @@ -508,6 +508,86 @@ mem_append_to_binary(struct Mem *mem, const char *value, uint32_t size) > return 0; > } > > +void > +mem_set_ephemeral_map(struct Mem *mem, char *value, uint32_t size) > +{ > + assert(mp_typeof(*value) == MP_MAP); > + mem_set_const_bin(mem, value, size, MEM_Ephem); > + mem->flags |= MEM_Subtype; > + mem->subtype = SQL_SUBTYPE_MSGPACK; > + mem->field_type = FIELD_TYPE_MAP; > +} > + > +void > +mem_set_static_map(struct Mem *mem, char *value, uint32_t size) > +{ > + assert(mp_typeof(*value) == MP_MAP); > + mem_set_const_bin(mem, value, size, MEM_Static); > + mem->flags |= MEM_Subtype; > + mem->subtype = SQL_SUBTYPE_MSGPACK; > + mem->field_type = FIELD_TYPE_MAP; > +} > + > +void > +mem_set_dynamic_map(struct Mem *mem, char *value, uint32_t size) I think I lost the clue of what is the difference between dynamic and allocated. Maybe worth adding a comment? Or find a better name? For instance, if one of them is supposed to copy the map, and the other one to steal its ownership, then you could call them mem_set_map_copy() and mem_set_map_move(), where move is the same as C++ move - steal the resource. The same for the others dynamic/allocated terminology in the function names. I think I also lost the understanding of static vs ephem by now.