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 6E17F6EC5B; Tue, 30 Mar 2021 01:58:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6E17F6EC5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617058702; bh=XArP0ZyeDU1pT9+oCjYS5Pr1b5lwVYXVXJiZPlHSD7E=; 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=sd7aNWI1YRMgtF2putqtdLutRSo9ciCjd8tbzZsS0FvKByKH+RjZ+n7Hv0Jze7uSv CLk5XUlFE/dD8fEjedWKvR7heELNQHImpqs74G8F2ynCdwBmKayRgLhh5QzD+LZtzZ qgEW0VnDJGSp5rLGf92mB6Zi+zVT6aiaigxNKerE= 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 A3B8B6EC5B for ; Tue, 30 Mar 2021 01:58:19 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A3B8B6EC5B Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lR0pu-00064G-U3; Tue, 30 Mar 2021 01:58:19 +0300 To: imeevma@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: <0ad3d2e6b109dad1bbc78811ca01443518363fbb.1616491731.git.imeevma@gmail.com> Message-ID: Date: Tue, 30 Mar 2021 00:58:17 +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: <0ad3d2e6b109dad1bbc78811ca01443518363fbb.1616491731.git.imeevma@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E32947427BE79D20CABD4ABD7C98AF5DBFD37182A05F5380850406FD82BF866BC73C0D97298A2661877D865E2C699D0D677CF095260B73594ABE6 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70186A8DAAA7CBDB1EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F7C2A16C2A438FE58638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95CE99938B3FD79E1DF080C62BB87979A6A8D57A8FA4BC667A2A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE71AE4D56B06699BBC9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3ED8438A78DFE0A9E117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD1A18204E546F3947C0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735444A83B712AC0148C4224003CC83647689D4C264860C145E X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831B7DABD8F4FAFB02F86445F3BB20A73D6 X-C1DE0DAB: 0D63561A33F958A5DD74E07120727FECC8CBB84A367490D636D89D138D499779D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34505665BFD4C70705254763C00A7F55407DAD6E10DE50DF4F68372E533936397D10A8CD2D9BACF9E71D7E09C32AA3244CC4D42295C5A10C913545398D5F8E38F86C24832127668422FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojljIiQOC84rQs+7MS9eMIVA== X-Mailru-Sender: 689FA8AB762F73936BC43F508A06382212086359210D2052245F4C1EA6FA4DA83841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v4 05/53] sql: move MEM-related functions to mem.c/mem.h 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! I didn't compare each line of each moved function with its original code, so I trust you didn't make any functional changes. See 2 comments below. > diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c > new file mode 100644 > index 000000000..62338e1db > --- /dev/null > +++ b/src/box/sql/mem.c > @@ -0,0 +1,2376 @@ <...> > + > + > +#ifdef SQL_DEBUG > +/* > + * This routine prepares a memory cell for modification by breaking > + * its link to a shallow copy and by marking any current shallow > + * copies of this cell as invalid. > + * > + * This is used for testing and debugging only - to make sure shallow > + * copies are not misused. > + */ > +void > +sqlVdbeMemAboutToChange(Vdbe * pVdbe, Mem * pMem) 1. This is a vdbe method, not mem. It takes mem as an argument, but is a method of vdbe struct. Lets keep it in the old place. > +{ > + int i; > + Mem *pX; > + for (i = 0, pX = pVdbe->aMem; i < pVdbe->nMem; i++, pX++) { > + if (pX->pScopyFrom == pMem) { > + pX->flags |= MEM_Undefined; > + pX->pScopyFrom = 0; > + } > + } > + pMem->pScopyFrom = 0; > +} <...> > + > +/* > + * Print the SQL that was used to generate a VDBE program. > + */ > +void > +sqlVdbePrintSql(Vdbe * p) 2. Ditto. Such functions should be moved to vdbe.h/vdbe.c eventually. And ideally mem.h/mem.c should not know about vdbe anything (probably can't be done now). > +{ > + const char *z = 0; > + if (p->zSql) { > + z = p->zSql; > + } else if (p->nOp >= 1) { > + const VdbeOp *pOp = &p->aOp[0]; > + if (pOp->opcode == OP_Init && pOp->p4.z != 0) { > + z = pOp->p4.z; > + while (sqlIsspace(*z)) > + z++; > + } > + } > + if (z) > + printf("SQL: [%s]\n", z); > +}