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 E520E6D3F5; Mon, 25 Oct 2021 11:55:01 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E520E6D3F5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1635152102; bh=Tt1hSotu6YQEXDQTbcM6eV3HAF3+jNsK1337opdjnzs=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=ilMNdkA6tXmJEsGh+CiLDGBV6yWzjpepWivKhKE2koNan9qCWw+l81ernLIbaomeX jvLAh3Q6Hh5uOy2XZj7J5Jd0l8/RxNvCuBC9yabHBqMkhyXhUWULoS+xr7D9oIX8hg /DB200MBVfl+JmpDi1RfydjGJ/I3Sy4cK6mBjgzs= 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 231C46D3F5 for ; Mon, 25 Oct 2021 11:55:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 231C46D3F5 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mevkx-00035l-Ej; Mon, 25 Oct 2021 11:54:59 +0300 Date: Mon, 25 Oct 2021 11:54:58 +0300 To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org Message-ID: <20211025085458.GM36295@tarantool.org> References: <86bc99060c5e4a37a4ee5df2c1b98cd8f77e4765.1633713433.git.imeevma@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9C7814344C8C501C81DF2D982FCC3642ABC592EA95DC3FE9F182A05F5380850404607C1C15860C08762C2B2A22947089BB9456F68EFA8C7A19DA429B966519D7D X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BCC85671EC7A750CEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F832FB01FC7F589C8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D89F299597768069007C01057D78178A4E117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC2EE5AD8F952D28FBA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751FF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B953A8A48A05D51F175ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5963569719A5168530DD34B88C4EB5456B66322AA71C7FA92D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75FA7FF33AA1A4D21C410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D346EDE9E12965E8CD5B79A6B4418BF889A6B7291BE38D715E4EF6F88B33A51538245C25EE57C12B6A21D7E09C32AA3244C8EC985629A3F87D03FB4C02E07B886E61E098CBE561D6343729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojPL6H901iH3GraGl4b/mXPw== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D81C4AC5ED07AC7A292BFE0F3AEA54C1883D72C36FC87018B9F80AB2734326CD2FB559BB5D741EB96352A0ABBE4FDA4210A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 19/21] sql: remove MEM_Dyn flag 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: Mergen Imeev Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thank you for the review! My answer and diff below. There will be a bit more changes due to chages in the previous patch-sets. On Fri, Oct 15, 2021 at 12:46:09AM +0200, Vladislav Shpilevoy wrote: > Thanks for the patch! > > > diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c > > index 895003580..a001ac8c5 100644 > > --- a/src/box/sql/mem.c > > +++ b/src/box/sql/mem.c > > @@ -2689,15 +2623,12 @@ sqlVdbeMemPrettyPrint(Mem *pMem, char *zBuf) > > if (pMem->type == MEM_TYPE_BIN) { > > int i; > > char c; > > - if (f & MEM_Dyn) { > > - c = 'z'; > > - assert((f & (MEM_Static|MEM_Ephem))==0); > > - } else if (f & MEM_Static) { > > + if (f & MEM_Static) { > > 1. != 0. > Fixed. > > c = 't'; > > - assert((f & (MEM_Dyn|MEM_Ephem))==0); > > + assert((f & MEM_Ephem) == 0); > > } else if (f & MEM_Ephem) { > > c = 'e'; > > - assert((f & (MEM_Static|MEM_Dyn))==0); > > + assert((f & MEM_Static) == 0); > > } else { > > c = 's'; > > } > > @@ -2721,15 +2652,12 @@ sqlVdbeMemPrettyPrint(Mem *pMem, char *zBuf) > > } else if (pMem->type == MEM_TYPE_STR) { > > int j, k; > > zBuf[0] = ' '; > > - if (f & MEM_Dyn) { > > - zBuf[1] = 'z'; > > - assert((f & (MEM_Static|MEM_Ephem))==0); > > - } else if (f & MEM_Static) { > > + if (f & MEM_Static) { > > 2. != 0. > Fixed. > > zBuf[1] = 't'; > > - assert((f & (MEM_Dyn|MEM_Ephem))==0); > > + assert((f & MEM_Ephem)==0); > > } else if (f & MEM_Ephem) { > > zBuf[1] = 'e'; > > - assert((f & (MEM_Static|MEM_Dyn))==0); > > + assert((f & MEM_Static)==0); > > 3. Spaces around == here and above. Fixed. Diff: diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c index 4f550f3e4..4150a24f0 100644 --- a/src/box/sql/mem.c +++ b/src/box/sql/mem.c @@ -1854,7 +1854,7 @@ mem_append(struct Mem *mem, const char *value, uint32_t len) if (len == 0) return 0; int new_size = mem->n + len; - if (((mem->flags & (MEM_Static | MEM_Dyn | MEM_Ephem)) != 0) || + if (((mem->flags & (MEM_Static | MEM_Ephem)) != 0) || mem->szMalloc < new_size) { /* * Force exponential buffer size growth to avoid having to call @@ -2628,7 +2628,7 @@ sqlVdbeMemPrettyPrint(Mem *pMem, char *zBuf) if (pMem->type == MEM_TYPE_BIN) { int i; char c; - if (f & MEM_Static) { + if ((f & MEM_Static) != 0) { c = 't'; assert((f & MEM_Ephem) == 0); } else if (f & MEM_Ephem) { @@ -2657,12 +2657,12 @@ sqlVdbeMemPrettyPrint(Mem *pMem, char *zBuf) } else if (pMem->type == MEM_TYPE_STR) { int j, k; zBuf[0] = ' '; - if (f & MEM_Static) { + if ((f & MEM_Static) != 0) { zBuf[1] = 't'; - assert((f & MEM_Ephem)==0); + assert((f & MEM_Ephem) == 0); } else if (f & MEM_Ephem) { zBuf[1] = 'e'; - assert((f & MEM_Static)==0); + assert((f & MEM_Static) == 0); } else { zBuf[1] = 's'; } diff --git a/src/box/sql/mem.h b/src/box/sql/mem.h index 76ba666fd..d2e9cc135 100644 --- a/src/box/sql/mem.h +++ b/src/box/sql/mem.h @@ -225,8 +225,7 @@ mem_is_allocated(const struct Mem *mem) static inline bool mem_is_trivial(const struct Mem *mem) { - return mem->szMalloc == 0 && (mem->flags & MEM_Dyn) == 0 && - mem->type != MEM_TYPE_FRAME; + return mem->szMalloc == 0 && mem->type != MEM_TYPE_FRAME; } static inline bool