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 1466F6BD0D; Sun, 11 Apr 2021 20:46:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1466F6BD0D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618163169; bh=JMJTkrypx78vGhYXPTPcxFYc7cxbDHA6vPDx9sDsDK8=; 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=FKb72yE3EXx2oJtNWsvY7COVOIfYMp6B9o27joQQUF29SvIJZl11MjtR67mcG/hkY EINd53ZfbWzO7trb/IkGn3m3YvGzIdCAfdFmD5gzK3yqXTWa9MmjKRxC6hcbzRsAY1 GNELFZvBApv52NF4Jt8FNMuSUAUwLLvtSnrE0Igs= 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 C727E6BD0C for ; Sun, 11 Apr 2021 20:46:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C727E6BD0C Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lVe9v-0002dN-0a; Sun, 11 Apr 2021 20:46:07 +0300 To: imeevma@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: <11ded2818e5dc4b3a60553c57d841de22be5bbe6.1617984948.git.imeevma@gmail.com> Message-ID: <980f6b69-d0b2-3c6a-12a0-cd6ed0a4d2fe@tarantool.org> Date: Sun, 11 Apr 2021 19:46:05 +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: <11ded2818e5dc4b3a60553c57d841de22be5bbe6.1617984948.git.imeevma@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E74806859AC5FE18436AEED970E897805ADA4182A05F538085040A83A9E80EBD82AE2645C80FD9476A26983E10C0A4599DD37612B322C81AC276C X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE77603ADE015AF816DEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063721BEEAF38C6AE0B78638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B29B69792A02DAA02BABCE98219D7809A942232221D1CC1427D2E47CDBA5A96583C09775C1D3CA48CFE478A468B35FE767117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE79AE9BAF3542BD4619FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA73A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E73542F54486E6D6388DC4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A59DB875C12DA4AF089684F3FEBF83A32A8F36C9E39FAE1A0AD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34CC972AA0E2E780C43042B1280634481AF4183A934F0E24F9C727C6A144DA811BF3A58C4B9760C16B1D7E09C32AA3244C6DA753FD1DF5210D4836D08685B25BDFE3D93501275E802FFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojyKKJYJ15DtLrDXJjFNRphw== X-Mailru-Sender: 689FA8AB762F73936BC43F508A06382272F36C793CB8156B7C81D27A99F40D023841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v5 11/52] sql: introduce mem_destroy() 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 working on this! See 3 comments below. On 09.04.2021 19:36, Mergen Imeev via Tarantool-patches wrote: > This patch introduces mem_destroy(). This function should be used to > free and destroing all objects owned by MEM, if necessary. 1. "to free and destroy". > Part of #5818 > --- > diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c > index 5135637d9..805dc7054 100644 > --- a/src/box/sql/mem.c > +++ b/src/box/sql/mem.c > @@ -92,6 +92,38 @@ mem_create(struct Mem *mem) > + > +void > +mem_destroy(struct Mem *mem) > +{ > + mem_clear(mem); > + if (mem->szMalloc > 0) > + sqlDbFree(mem->db, mem->zMalloc); > + mem->n = 0; > + mem->z = NULL; > + mem->szMalloc = 0; > + mem->zMalloc = NULL; 2. You could move szMalloc and zMalloc nullification under the 'if' above. > +} > @@ -1384,7 +1359,7 @@ sqlValueFree(sql_value * v) > { > if (!v) > return; > - sqlVdbeMemRelease((Mem *) v); > + mem_destroy((Mem *) v); 3. No need for whitespace after unary operators.