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 A356C6EC58; Sun, 1 Aug 2021 18:04:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A356C6EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1627830290; bh=obtnlL1/58yZE3401SThiKT1ALGznIvszQfj6al2NZI=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=zkoEb6Ds0fZjjC+dy8xzkzt9PAwd+UgJ/L7jBh7S2mqzRcA1Y6lfmbDnP2JDJBUHW Xsimp7SrbcGjawbG6JQSau1xGxBTmZA5klT6TFHct4RQVrTEPBzau0YYTzAnzha/k+ X74k/UklEgxp+NnWEEc8KiSdfqhAQrkbwbVu+yLc= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [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 3D0136EC58 for ; Sun, 1 Aug 2021 18:04:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3D0136EC58 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1mAD0Z-0007lY-FT; Sun, 01 Aug 2021 18:04:07 +0300 To: Sergey Ostanevich References: <175f212fc092d0da8e5d773160042db5770fee2e.1627420835.git.v.shpilevoy@tarantool.org> Message-ID: <030ca5d7-9dc9-84b6-0e4f-554629777b5b@tarantool.org> Date: Sun, 1 Aug 2021 17:04:06 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD941C43E597735A9C351B198F4576AC7B2770D7874BA03B4AE182A05F53808504068E0A12527F05322D202656208D932E994C1FE6BEA2DD151CBFEEA22597860B2 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE79145AB6E9E75F07EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006377BAB68A65B44F13B8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D86943703727D2EE9923FC60762FF7D76E117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC2EE5AD8F952D28FBA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18BDFBBEFFF4125B51D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B613439FA09F3DCB32089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A5F136BD3CBE87727A327F880122BE8DCAF3F8867C121F8AAAD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA751B940EDA0DFB0535410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34AA13E2DDB90678629880B912143A365ED74477B6BE58A27304088E77964C4AACD695ECE4C39493521D7E09C32AA3244CEB1A17DF1D619664EFD5B72D89BC9557F165894D92D62706FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojMCfuYI4PreeX1UoRuapLOw== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D42E3E92146ED830257B661A5D24C4BF23841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 4/5] decimal: introduce decimal_to_string 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 Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for the review! On 29.07.2021 13:52, Sergey Ostanevich wrote: > Hi! Thanks for the patch, my 2 cents below. > > Otherwise - LGTM. > > Regards, > Sergos > > >> On 28 Jul 2021, at 00:24, Vladislav Shpilevoy wrote: >> >> It saves decimal as a string into an externally passed buffer. > > Please mention decimal_to_string() introduction. It is in the commit title already. I don't want to duplicate the title in the message. >> diff --git a/src/lib/core/decimal.c b/src/lib/core/decimal.c >> index 4befbda37..6d2ccb96f 100644 >> --- a/src/lib/core/decimal.c >> +++ b/src/lib/core/decimal.c >> @@ -175,6 +175,14 @@ decimal_str(const decimal_t *dec) >> return buf; >> } >> >> +void >> +decimal_to_string(const decimal_t *dec, char *str) >> +{ >> + char *tmp = decNumberToString(dec, str); >> + assert(str == tmp); > > Why? The decToString() doesn't touch original string pointer, working on > a local copy. Yes, this is why there is the assertion. Also to be consistent with decimal_str() which has the same assert. >> + (void)tmp; >> +}