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 1305F6B967; Wed, 14 Apr 2021 02:01:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1305F6B967 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618354865; bh=/HGaB3IZBnD20/ct/EDC1NWKhNfuE1xsXANnooL0e6A=; 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=Kaaj+bSP9ouguafPzawYdumrKW7bRRCBz0Bjfe2YhwsJl7DjCQ7KagShNEqZwDBOl QzRDTAh+dVMejdDLqls5meLoZYu7/5CZSfUUNHbkVnorGU5S9PrKwxmfix1nHHY2SI C5EVJ2qzTsLbrrVDFlaHEX07aFN4LE9cMjRgzVeU= 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 312246B962 for ; Wed, 14 Apr 2021 02:01:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 312246B962 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lWS1n-0007k3-BF; Wed, 14 Apr 2021 02:01:03 +0300 To: imeevma@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: <921ae5a9b533bd897100dc2e7923347638719b13.1618000037.git.imeevma@gmail.com> Message-ID: <57fdcb76-1935-ff3d-ca70-9edf3a4bd640@tarantool.org> Date: Wed, 14 Apr 2021 01:01:02 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <921ae5a9b533bd897100dc2e7923347638719b13.1618000037.git.imeevma@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E74806859AC5FE18436AEED970E897805ADA4182A05F53808504026EA05FA3435ACA04AEED4AC9CF9BAFA9A4A1EBA1BA9994DB44797F28DAD1A42 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7B9FBA884A7C9B8BAEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006376EC5B14D896A2D978638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B24D1A1BFAD3DDC2679112F776C713123F21114FFCE5AE9CDCD2E47CDBA5A96583C09775C1D3CA48CFCF36E64A7E3F8E58117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE77FFCE1C639F4728C9FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA73A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735CE5475246E174218B5C8C57E37DE458BEDA766A37F9254B7 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C978317F9D6E0796D64B7DAB73A7D1547457A7 X-C1DE0DAB: 0D63561A33F958A520FFC77A458DF6122658D2C8601A3F54F63DC3DFFA8BDF8ED59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34697E0FA301E28215484DE46FFFBFD1A5485BFBCE5666918FFB9F33B8747A33F211DB36F4F84BA8CA1D7E09C32AA3244C5A03A3DAB1A66B8DB8ACF0F87675004535DA7DC5AF9B58C0FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojnA7/qPBUIXEsLkGnMU6C8g== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638220A5CE08FFA7F5732E6ECE4280C64E7233841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v5 45/52] sql: introduce mem_get_int() 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" Nice fixes! On 09.04.2021 22:53, Mergen Imeev via Tarantool-patches wrote: > Thank you for the review! My answers and new patch below. > > > On 30.03.2021 02:08, Vladislav Shpilevoy wrote: >> Thanks for the patch! >> >>> diff --git a/src/box/sql/func.c b/src/box/sql/func.c >>> index b644c39d8..0fa0f6ac7 100644 >>> --- a/src/box/sql/func.c >>> +++ b/src/box/sql/func.c >>> @@ -1532,10 +1543,11 @@ hexFunc(sql_context * context, int argc, sql_value ** argv) >>> static void >>> zeroblobFunc(sql_context * context, int argc, sql_value ** argv) >>> { >>> - i64 n; >>> + int64_t n; >>> assert(argc == 1); >>> UNUSED_PARAMETER(argc); >>> - n = sql_value_int64(argv[0]); >>> + bool unused; >>> + mem_get_integer(argv[0], &n, &unused); >> >> The flag is never used anywhere except one assertion where you can >> check the integer value instead. I think you can drop this out >> parameter. In future we could add mem_get_int_with_sign() or something >> like that if necessary. > I think the problem here mostly because most of built-in functions and bitwise > operations cannot work with our INTEGER. They can only work with int64. I > believe, if we fix this problem, there will be no problems with having this > flag. My complaint is about the flag. The third argument which is almost never used. It makes the code ugly, and does not give a clue it is broken in fact. When uint64_t is > INT64_MAX and is returned as int64_t and the flag is ignored. What about mem_get_int_unsafe()? It would return int64_t truncated like before. Return as 'return', not out parameter. Because we also never check for fail as I see. And no 'unused' flag. But we would clearly see that these places are broken and need attention.