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 C4EB16EC40; Thu, 23 Sep 2021 01:50:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C4EB16EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1632351043; bh=qdN6oj/Fvb3pYxA6Kz+ymDrHORWMdeoksO7DPXz+4kA=; 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=YjTcuoeVbboVXniScQQkN03EH6UFAzlWT80IeGSX4E5WYphKg8sSr6h/q/Uydwsrf NLQB17U6cPCNffB9HoHnSuN1Mtx90JSismKEvB7uio/5cOdejRu/hzlSzYZxS5tcYA Yl1Hqd5AUVa6HLzceDWLztVFwl+sC91ISXSuXy84= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (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 7E1C56EC40 for ; Thu, 23 Sep 2021 01:50:41 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7E1C56EC40 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mTB4a-0005Np-Tl; Thu, 23 Sep 2021 01:50:41 +0300 To: imeevma@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: Message-ID: <5c26f6af-064e-b024-5e63-2808ddb97173@tarantool.org> Date: Thu, 23 Sep 2021 00:50:40 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.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: 4F1203BC0FB41BD91AE02D33A9C88A2F5B11AABA1A86F90E3128B236C8D9319300894C459B0CD1B97E1A87C04A950B54FD8EF6E7921257A5016E8B5CE2B675A4AC24CE1637B2CF5B X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7780BADBB53F1FA59C2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE7C27E92EFAD44F80DEA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BBCA57AF85F7723F26CBB84A1B4FAF1A97385FCC0A3CC3CC0CC7F00164DA146DAFE8445B8C89999728AA50765F7900637F924B32C592EA89F389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8BC0ADEB1C81BB362F6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B08F9A42B2210255C75ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B505399A639CCD47381379C55DD6CCA3363C X-C1DE0DAB: 0D63561A33F958A5D3A3A76E82AA9919C0A11F69EF0BD1DC3FBF3ABB80A43883D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA759D2A03B9C34326B3410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D340EEB18E491831571C34680B10D0C723E764546B3E146CE0EB6EA9CC6805A2CE2759F5708AD9DA4A01D7E09C32AA3244CFAAD581B434EB3F390F34A6864C3F4E8250262A5EE9971B0729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojYVPXnTWjYf7LkWHlE+vDAQ== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D5092B4FDF252CA596E8E233AC7506EFC3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 13/15] sql: remove copying of result in finalizers 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/vdbe.c b/src/box/sql/vdbe.c > index 8804e3d18..65bb60d2f 100644 > --- a/src/box/sql/vdbe.c > +++ b/src/box/sql/vdbe.c > @@ -4207,24 +4200,10 @@ case OP_AggFinal: { > struct func_sql_builtin *func = (struct func_sql_builtin *)pOp->p4.func; > struct Mem *pIn1 = &aMem[pOp->p1]; > > - struct sql_context ctx; > - memset(&ctx, 0, sizeof(ctx)); > - struct Mem t; > - memset(&t, 0, sizeof(t)); > - t.type = MEM_TYPE_NULL; > - assert(t.flags == 0); > - t.db = pIn1->db; > - ctx.pOut = &t; > - ctx.pMem = pIn1; > - ctx.func = pOp->p4.func; > - func->finalize(&ctx); > - assert((pIn1->flags & MEM_Dyn) == 0); > - if (pIn1->szMalloc > 0) > - sqlDbFree(pIn1->db, pIn1->zMalloc); > - memcpy(pIn1, &t, sizeof(t)); > - > - if (ctx.is_aborted) > - goto abort_due_to_error; > + if (func->finalize != NULL) { > + if (func->finalize(pIn1) != 0) Such places might look simpler and shorter if you would use &&: if (func->finalize != NULL && func->finalize(... Up to you.