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 629896BD28; Tue, 13 Apr 2021 02:37:54 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 629896BD28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618270674; bh=VvGOlFsIO6GZcOi6O67IN0buFcxFDvpUklj/bthpEaU=; 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=zMr353GeN5ZNr31bDVXlU5KWUH5Z80vDhurAieJMgPSgpEL1hcOjo+SNw1uNYMMVQ K4DO9ZGK6So/3iFMU7+zJ0A7nt3630WvLwK9zFoAYJLMFjd5OGaSFWvL3mz+CevA7S 56q/DU3GTN9zurJm9GinodQIKcY0ZygvxslZaS8Q= 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 6D6CA6BD23 for ; Tue, 13 Apr 2021 02:37:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6D6CA6BD23 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lW67q-0005dC-P6; Tue, 13 Apr 2021 02:37:51 +0300 To: imeevma@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: <200616f9ee5708f14c565046e2e01eacbef2be62.1617984948.git.imeevma@gmail.com> Message-ID: <011884a7-5727-83c1-e2f3-aa7b849dafd4@tarantool.org> Date: Tue, 13 Apr 2021 01:37:49 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <200616f9ee5708f14c565046e2e01eacbef2be62.1617984948.git.imeevma@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480257C85EA0BB7A95D0F00AE41BB9A5343182A05F5380850400E4EBEAD86466B338E62EE81EE83748EB01047F4EBB3BCCFF57C0D504DA32DC6 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE75DF2B1F23425CAE5EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063781BF90BB6B3E56078638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2238E9C7EB1DCC70AE4B743B3A0FE932E6FD1C55BDD38FC3FD2E47CDBA5A96583C09775C1D3CA48CF7EF884183F8E4D67117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE77FFCE1C639F4728C9FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA73A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735D2D576BCF940C736C4224003CC83647689D4C264860C145E X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831E00599780DECE58D60D789705920FE00 X-C1DE0DAB: 0D63561A33F958A5B378917D1EBE3013E1B7580E7A69BC43F02B1F6D437DDC27D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34E318F287A436F24CA0B49936CFA29D9109B9FA508BD35BC2B81D6376CC21B3789B3046114FC4CA941D7E09C32AA3244C1CFC6FE6552C286601D515DA717BDCCACE0B41342B755BCDFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojq8JA+pXcDulq+ft3ukMbgQ== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638229046255E6ED2477DEA372265A0C0E2DE3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v5 36/52] sql: introduce mem_set_agg() 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 fixes! > diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c > index b2598816d..af11ae1d5 100644 > --- a/src/box/sql/mem.c > +++ b/src/box/sql/mem.c > @@ -612,6 +612,23 @@ mem_set_frame(struct Mem *mem, struct VdbeFrame *frame) > mem->u.pFrame = frame; > } > > +int > +mem_set_agg(struct Mem *mem, struct func *func, int size) > +{ > + if (size <= 0) { > + mem_clear(mem); > + return 0; > + } > + if (sqlVdbeMemGrow(mem, size, 0) != 0) > + return -1; > + memset(mem->z, 0, size); > + mem->n = size; > + mem->flags = MEM_Agg; What if it already was MEM_Agg before? sqlVdbeMemGrow() didn't clear the old value. It clears only MEM_Dyn. > + mem->u.func = func; > + mem->field_type = field_type_MAX; > + return 0; > +}