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 CC1A46C185; Tue, 30 Mar 2021 02:14:58 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org CC1A46C185 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617059698; bh=GpELYb6icvHckM6zQU8ekUkxYhs3DUaIEOpoQSLrOS0=; 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=WKnYTvf4ni3bvOUIaahZ3wGM4O/ris0hDfkANwXwBJ0H6AM5mn04ZHboC3p8fIZ1D 49FVb6az/Af2mRTsivqYyPqgfENXHAJRaTpMk/xqs9gil/wEgUPqRQ90gzVIaNAOuT FlSqitruEDFL5sQhiQo0O/HX2Qf0vz9gL1BZqZXQ= 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 794FA6BD19 for ; Tue, 30 Mar 2021 02:08:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 794FA6BD19 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lR103-0003cq-P1; Tue, 30 Mar 2021 02:08:48 +0300 To: imeevma@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: Message-ID: Date: Tue, 30 Mar 2021 01:08:46 +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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E32947287414FD1D04A09E656A5F3377C994A182A05F5380850402D7A38F5BD761090084B6696894AF41354DE40B610494F4BE22FBAD18ACAFEBC X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7EA4B66823129EB3CEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637822A0A225AD602F38638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95CE99938B3FD79E1DF6D5810B22CBA3C2A652D516F5D298654A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE77A825AB47F0FC8649FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3BD39A56654533F91117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD1A18204E546F3947C0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E7356A58BF81F659395FC4224003CC83647689D4C264860C145E X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831A4C110CAD6AA92398513B07AB14EF0B5 X-C1DE0DAB: 0D63561A33F958A519431422EB74F2A82A6EB582DD567C54CEDE7D4A80410624D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D342F9EE325F82A28A88EB74B20901012E642B9341F8419ECA85A21609E6EC9D47E763401F72E845D901D7E09C32AA3244CC3ABF0981CD6E83DE0F6D2BCC067F0E233C9DC155518937FFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojljIiQOC84rQtP4ey+bX83Q== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638224EE4E5013A733D07F1C5C6D3BA3DAAAF3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v4 48/53] sql: introduce mem_get_unsigned() 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! On 23.03.2021 10:36, Mergen Imeev via Tarantool-patches wrote: > This patch introduces mem_get_unsigned() function which is used to > receive unsigned value from MEM. > > Part of #5818 > --- > src/box/sql/func.c | 16 +++++++++++----- > src/box/sql/mem.c | 37 +++++++++++++++++++++++++++---------- > src/box/sql/mem.h | 6 +++--- > src/box/sql/sqlInt.h | 3 --- > src/box/sql/vdbeapi.c | 6 ------ > 5 files changed, 41 insertions(+), 27 deletions(-) > > diff --git a/src/box/sql/func.c b/src/box/sql/func.c > index 0fa0f6ac7..a851d98f2 100644 > --- a/src/box/sql/func.c > +++ b/src/box/sql/func.c > @@ -118,9 +118,12 @@ port_vdbemem_dump_lua(struct port *base, struct lua_State *L, bool is_flat) > luaL_pushint64(L, n); > break; > } > - case MP_UINT: > - luaL_pushuint64(L, sql_value_uint64(param)); > + case MP_UINT: { > + uint64_t u; > + mem_get_unsigned(param, &u); > + luaL_pushuint64(L, u); Maybe we could make 2 functions? One to get the value and ignore the errors, and the other to get as an out parameter + return an error? For instance, mem_to_uint() - returns uint64_t and internally asserts that the value is correct. And mem_get_uint() works like your version. The same for the other get functions whose result is often ignored.