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 54E5868F46; Tue, 23 Mar 2021 12:54:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 54E5868F46 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1616493258; bh=LAX/kf++QDE8zHBKolqDTSSAH2raKFf3P5SRtW07jfw=; h=To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=S2ofVEClMy05IN5p5eM4yE+g9R6vYR4IAcFD1CIWuUZ7XfdgA0fgPMfE5pXRW1J65 64IQCld6Qkr7aHYvM0p7iDy6p/4Oa9M3mvIkm2coz050T57rbRZLV6d0frXY5VW8w1 p95pZswzr5FXc/rRiHUgTECG+/lHyCsl4SCfInuw= Received: from smtp3.mail.ru (smtp3.mail.ru [94.100.179.58]) (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 8078B68F5D for ; Tue, 23 Mar 2021 12:36:20 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8078B68F5D Received: by smtp3.mail.ru with esmtpa (envelope-from ) id 1lOdSV-0007E1-Ts; Tue, 23 Mar 2021 12:36:20 +0300 To: v.shpilevoy@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org Date: Tue, 23 Mar 2021 12:36:19 +0300 Message-Id: <9dc32673fb411fa41c4bc1d83d33c1ea438e97c4.1616491731.git.imeevma@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD95D6E7CC48CB1F5F1C82687294EF6886B62CC997B0B8C95C4182A05F538085040D02AEB38B51F5A132C59B914451B32E77AAC7B1A0DCC339F1A23EB18036EA69C X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE704FFE27C31EF363AEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063702DFA59B3C994360EA1F7E6F0F101C67CDEEF6D7F21E0D1D174C73DBBBFC7664D54267400E4E38EC7B5A602E4988D74B0B3487587D77E748389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0D1611F633B8B34AD8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6CE66FDB1904541E0CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249CDB759F01BBAF1DE76E601842F6C81A12EF20D2F80756B5F7E9C4E3C761E06A776E601842F6C81A127C277FBC8AE2E8BA39938E46083989B3AA81AA40904B5D9DBF02ECDB25306B2201CA6A4E26CD07C3BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B091A620F70A64A45A99449624AB7ADAF3735872C767BF85DA29E625A9149C048EE0A3850AC1BE2E73557739F23D657EF2BC8A9BA7A39EFB7666BA297DBC24807EA089D37D7C0E48F6C8AA50765F7900637C3090DF2C0002BD1EFF80C71ABB335746BA297DBC24807EA27F269C8F02392CDC58410348177836E285124B2A10EEC6C00306258E7E6ABB4E4A6367B16DE6309 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C686AF563A045C75E258E315741F9085649E256983FF6DAED9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF0417BEADF48D1460699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349F4E6BC39AAD02BBA0876F95144CB9BD9D4B16ED64A992985D4F9901850355D625FB01D6C5E7CDF31D7E09C32AA3244C36D09006E09EB0156E327E01499C4A3BB018FE5BB746DCD1FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojWJZv20R+6UjVs6Y6TW/l6g== X-Mailru-Sender: 5C3750E245F362008BC1685FEC6306ED89DC329E60A4780A2C59B914451B32E72F2E01304D987C7F5105BD0848736F9966FEC6BF5C9C28D97E07721503EA2E00ED97202A5A4E92BF7402F9BA4338D657ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v4 39/53] sql: introduce mem_set_cleared() 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: Mergen Imeev via Tarantool-patches Reply-To: imeevma@tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This patch introduces mem_set_cleared() function. Function mem_set_cleared() sets a NULL to MEM, however this NULL should be used only in internal VDBE operations. Part of #5818 --- src/box/sql/mem.c | 7 +++++++ src/box/sql/mem.h | 3 +++ src/box/sql/vdbe.c | 9 +++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c index 0211069c6..83f17250d 100644 --- a/src/box/sql/mem.c +++ b/src/box/sql/mem.c @@ -636,6 +636,13 @@ mem_get_aggregate(struct Mem *mem) return (void *)mem->z; } +void +mem_set_cleared(struct Mem *mem) +{ + mem_clear(mem); + mem->flags = MEM_Null | MEM_Cleared; +} + int mem_copy(struct Mem *to, const struct Mem *from) { diff --git a/src/box/sql/mem.h b/src/box/sql/mem.h index 51802b450..70224b55a 100644 --- a/src/box/sql/mem.h +++ b/src/box/sql/mem.h @@ -277,6 +277,9 @@ mem_prepare_aggregate(struct Mem *mem, struct func *func, int size); void * mem_get_aggregate(struct Mem *mem); +void +mem_set_cleared(struct Mem *mem); + int mem_copy(struct Mem *to, const struct Mem *from); diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c index b01b8d760..fdcb4d1e6 100644 --- a/src/box/sql/vdbe.c +++ b/src/box/sql/vdbe.c @@ -823,7 +823,7 @@ case OP_String: { /* out2 */ * is less than P2 (typically P3 is zero) then only register P2 is * set to NULL. * - * If the P1 value is non-zero, then also set the MEM_Cleared flag so that + * If the P1 value is non-zero, then also set the Cleared flag so that * NULL values will not compare equal even if SQL_NULLEQ is set on * OP_Ne or OP_Eq. */ @@ -833,13 +833,14 @@ case OP_Null: { /* out2 */ cnt = pOp->p3-pOp->p2; assert(pOp->p3<=(p->nMem+1 - p->nCursor)); if (pOp->p1 != 0) - pOut->flags = MEM_Null|MEM_Cleared; + mem_set_cleared(pOut); while( cnt>0) { pOut++; memAboutToChange(p, pOut); - mem_set_null(pOut); if (pOp->p1 != 0) - pOut->flags = MEM_Null|MEM_Cleared; + mem_set_cleared(pOut); + else + mem_set_null(pOut); cnt--; } break; -- 2.25.1