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 5D9486EC5B; Tue, 30 Mar 2021 02:08:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5D9486EC5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617059302; bh=DFb5zmazxSc+xeAL2s2b9R8O8J4gj7CTgL9QJ9qtjFo=; 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=cJEqY/rfTzpShj7ox8wjfZhdUZgUUCEnkfhb2YGPMjUddmU/xpqjtlZgd0kQWLMpb /v+pvy29J7e+8kXlbzGWsKsZRJ1DdHlGERv8TmVdoC+bKG4i3Zb4yEjtxC6Yqad7ck 3hb3dUFzqAhLKvoKZEmEwuR5rmuiQeZEUmtbL2PU= Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 91B686EC5B for ; Tue, 30 Mar 2021 02:05:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 91B686EC5B Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1lR0x7-0004dd-Q2; Tue, 30 Mar 2021 02:05:46 +0300 To: imeevma@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: Message-ID: <97cd1f47-ad52-e480-b2ff-4cf10cdc8d68@tarantool.org> Date: Tue, 30 Mar 2021 01:05:44 +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: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E329498ADEA61F680B110809A4DE3E6FC56EA182A05F5380850400C5E9B159B98774A86DBCEE50E3CEB38B00864B0898BD104B0CF5D06752946E7 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7AED985C8E545F588EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D19071B5A26B4BDC8638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95CE99938B3FD79E1DFE67728D3B7D69D942C8ED92B09A4F76DA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE77A825AB47F0FC8649FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3E97D2AE7161E217F117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD1A18204E546F3947C0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735F409322A2F59C95CC4224003CC83647689D4C264860C145E X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831FB965E4CF9DE7C1F2DAC2A4A94C307B6 X-C1DE0DAB: 0D63561A33F958A57CADF5EF34B6F9FD7AE1E780867DA1FA27F333A5D618B7F7D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D340A4C04F5DECA7EE9A2DBE0B41F6309120C13B548EC078903EDB7A656CB9A3B7B7C750CE61200B29F1D7E09C32AA3244CA7BF0D9CB549E3AFF3E90E64D345F86397FE24653F78E668FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojljIiQOC84rSK/5w/dzXqsw== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638225AD5709887E8E7A7B78A9923557A4E113841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v4 33/53] sql: introduce mem_append_to_binary() 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/vdbeaux.c b/src/box/sql/vdbeaux.c > index 86da1449c..2e8669138 100644 > --- a/src/box/sql/vdbeaux.c > +++ b/src/box/sql/vdbeaux.c > @@ -1305,19 +1305,26 @@ sqlVdbeList(Vdbe * p) > * has not already been seen. > */ > if (pOp->p4type == P4_SUBPROGRAM) { > - int nByte = (nSub + 1) * sizeof(SubProgram *); > int j; > for (j = 0; j < nSub; j++) { > if (apSub[j] == pOp->p4.pProgram) > break; > } > - if (j == nSub && > - sqlVdbeMemGrow(pSub, nByte, > - nSub != 0) == 0) { > - apSub = (SubProgram **) pSub->z; > - apSub[nSub++] = pOp->p4.pProgram; > - pSub->flags |= MEM_Blob; > - pSub->n = nSub * sizeof(SubProgram *); > + if (j == nSub) { > + uint32_t size = sizeof(SubProgram *); > + char *value = (char *)&pOp->p4.pProgram; > + if (nSub == 0) { > + if (mem_copy_binary(pSub, value, > + size) != 0) > + return -1; > + } else { > + assert(0); What is this assert? And why does not the append work on empty binaries? > + if (mem_append_to_binary(pSub, > + value, > + size) != 0) > + return -1; > + } > + ++nSub; > } > } > } >