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 9029E6EC5F; Thu, 15 Apr 2021 03:21:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9029E6EC5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618446084; bh=aElRxlI6+ebpjxOKoYFaXVFHohmOAONodvB8R3wk6nE=; 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=zboszyY7LfjepSmHlgVx2DuqtwanZcrTQlGCx8ewbg9x0grPqKTgV6BB1+jIcIQ74 2MWIdyZXmByExw80AkQkDbw74l8qhqeTBfTWc6YjrkWxcIU0tNFf+JE2OkuYyuVroD ESSmdHgQ/zuVPdECOYxXgszH7VdRQ19Kb5KzzAsY= 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 97A896EC5F for ; Thu, 15 Apr 2021 03:21:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 97A896EC5F Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1lWpl3-0000R4-Vc; Thu, 15 Apr 2021 03:21:22 +0300 To: Mergen Imeev Cc: tarantool-patches@dev.tarantool.org References: <326fac6c97ae260b32be9987e48e3381c600ba9c.1618000037.git.imeevma@gmail.com> <90cf544d-5188-ed34-face-15c231de09d1@tarantool.org> <20210414015548.GA185092@tarantool.org> Message-ID: <45bbd917-e5c9-1bf6-d621-8b5f80fd7d1b@tarantool.org> Date: Thu, 15 Apr 2021 02:21:20 +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: <20210414015548.GA185092@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E748094FADAEB10E66ADA4C48BE3C291E66DA182A05F5380850402130F17A65FD679119CD963D34C88B4F673BEE1FFD623789BBCAF4151EF6E249 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7EED5D2FAB4CEB1EDEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637BB46061768088B55EA1F7E6F0F101C67CDEEF6D7F21E0D1D9295C2E9FA3191EE1B59CA4C82EFA658415F03FD6D15B5EC1A2CECC53E14B0A3F6B57BC7E64490618DEB871D839B73339E8FC8737B5C22498424CA1AAF98A6958941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B68424CA1AAF98A6958941B15DA834481F9449624AB7ADAF372E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89F83C798A30B85E16BCE5475246E174218B5C8C57E37DE458BEDA766A37F9254B7 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831E4DBBF3629FB42598955918E15BC64BA X-C1DE0DAB: 0D63561A33F958A50D0124E01DCCC4A482316BD4CD588CBD1A9E70B1C067C2E8D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D344F2126FF337FA6515D9B71806F54EA2BBFC414B20673D243876F5F326D261C4D3797171EB9E0D7551D7E09C32AA3244C79A6D75FC85114C22B957EED8EF901DFA8CE788DE6831205729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojrcJA+pXcDunmuLqk+e0G0w== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638221F5A893BA3D5445B568AD11B2A2F68853841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v5 51/52] sql: introduce mem_get_bytes_len() 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! > diff --git a/src/box/sql/mem.h b/src/box/sql/mem.h > index e7612fe7e..a67345fbd 100644 > --- a/src/box/sql/mem.h > +++ b/src/box/sql/mem.h > @@ -870,6 +870,20 @@ mem_get_bin(const struct Mem *mem, const char **s); > int > mem_get_bytes_len(const struct Mem *mem, uint32_t *len); > > +/** > + * Return length of value for MEM of STRING or VARBINARY type. This function is > + * not safe since there is no proper processing in case mem_get_bytes_len() > + * return an error. In this case this function returns 0. > + */ > +static inline int > +mem_len_unsafe(const struct Mem *mem) > +{ > + uint32_t len; > + if (mem_get_bytes_len(mem, &len) != 0) For the sake of consistency the safe function should be called simply mem_len() IMO. > + return 0; > + return len; > +}