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 8DE2D6C1AE; Fri, 21 May 2021 21:59:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8DE2D6C1AE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1621623558; bh=1FQ/FLcDJqbNSrooR9BidSULv0PU40xBAJ1d6fYCeUg=; 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=otKuKfPkUyV3iN3TWhiHzMqA3/EIjm6U3+yB6saSqXn4mPnoz/pEJIxalIdZuJ6HD plr7EJ+4NOG3UVfSCaL11jBEP7nuGUFaru8eOAdk5LFb1bJABGvV/MJ14fnPZmJNo4 G0tTZOdbYoZD6qMYsl8iPnqP4NH3AedC76sd3OQg= 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 AA7A36C1AE for ; Fri, 21 May 2021 21:59:16 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org AA7A36C1AE Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1lkAMd-0000Zj-Uz; Fri, 21 May 2021 21:59:16 +0300 To: Mergen Imeev Cc: tarantool-patches@dev.tarantool.org References: <3f495b512c6d1a0e494c111ad37083f98c9988ad.1619540891.git.imeevma@gmail.com> <2ee164bc-76e0-0a42-aaa1-64583c3d7105@tarantool.org> <20210517121811.GA177791@tarantool.org> Message-ID: Date: Fri, 21 May 2021 20:59:14 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <20210517121811.GA177791@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD91B019B01C53E51AF113D6D562FBA72891FA115C4A817A10000894C459B0CD1B9DFA487AA7E7DB7F811DE4B019B803E4B88407E815559E65175C527A837F11872 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7956F10FFCC7409BAEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006370CE92FB8C11ED3D88638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B224B0E30329A76E4EC4A7005036DA097A51ACFDFAE348AC99D2E47CDBA5A96583C09775C1D3CA48CF62968DCAA3E4B45B117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE7985FEE833124D2D39FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA71A620F70A64A45A98AA50765F79006372E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89F83C798A30B85E16B156CCFE7AF13BCA4B5C8C57E37DE458BEDA766A37F9254B7 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C9783121800396A901F51CAE02DBCB839BB422 X-C1DE0DAB: 0D63561A33F958A5736086D24857FEB1450F378A86FBB18AA36968FD2A5F8B7CD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA752546FE575EB473F1410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3498910055B812BD9C0B74FE0E9ECB2CB57EFCFD4B16C46FF880B5C9DCE80BAF98C052C0E7283DC3A41D7E09C32AA3244CF5348209A602D018766D1D2D1B1B3CB58580396430872480729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj3CIvDNz8QqDa6H7xbeRmZg== X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822624811A567B34D0F4BE53B18ACE8BA4A3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 3/3] sql: replace MEM-type flags by enum mem_type 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" Hi! Thanks for the fixes! See 2 small comments below. > diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c > index b6ff6397f..f7788021d 100644 > --- a/src/box/sql/mem.c > +++ b/src/box/sql/mem.c > @@ -1155,11 +1214,11 @@ mem_get_str0(const struct Mem *mem, const char **s) > int > mem_get_bin(const struct Mem *mem, const char **s) > { > - if ((mem->flags & MEM_Str) != 0) { > + if (mem->type == MEM_TYPE_STR) { > *s = mem->n > 0 ? mem->z : NULL; > return 0; > } > - if ((mem->flags & MEM_Blob) == 0 || (mem->flags & MEM_Zero) != 0) > + if (mem->type != MEM_TYPE_BIN || (mem->flags & MEM_Zero) != 0) > return -1; 1. AFAIR, it is not possible to have MEM_Zero for non-bin. Which makes the second condition unreachable, right? The same in mem_len(). > *s = mem->z; > return 0; > @@ -1644,14 +1717,15 @@ mem_bit_not(const struct Mem *mem, struct Mem *result) > return -1; > } > result->u.i = ~i; > - result->flags = result->u.i < 0 ? MEM_Int : MEM_UInt; > + result->type = result->u.i < 0 ? MEM_TYPE_INT : MEM_TYPE_UINT; > + assert(result->flags == 0); > return 0; > } > > int > mem_cmp_bool(const struct Mem *a, const struct Mem *b, int *result) > { > - if ((a->flags & b->flags & MEM_Bool) == 0) > + if (a->type != MEM_TYPE_BOOL || b->type != MEM_TYPE_BOOL) 2. You could leave the old way so as to avoid || (branching). > return -1; > if (a->u.b == b->u.b) > *result = 0;