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 6D6056EC5F; Thu, 15 Apr 2021 02:22:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6D6056EC5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618442547; bh=yWLlJHTrEJlL9L7jmiEXihBHweIzT4ah6dXLQM81i0I=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=OLrf8PbuI9mrHzppc39A449oaEZxNyLapI/xrKl06f0iLaCQtLbDC5YsTWfEPu1kl HSC7EB0z4fSO4yvcurkxUdIV7dLkEXIlnxolOVnv3ScP2NLIaAyY+PeuHrqcDy+QuF casztGKGsT6nVHlxzfLy6ItftpLCh2dmuuVWN2nk= Received: from smtp3.mail.ru (smtp3.mail.ru [94.100.179.58]) (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 878326EC5F for ; Thu, 15 Apr 2021 02:22:26 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 878326EC5F Received: by smtp3.mail.ru with esmtpa (envelope-from ) id 1lWoq1-0006zg-Jc; Thu, 15 Apr 2021 02:22:26 +0300 Date: Thu, 15 Apr 2021 02:22:24 +0300 To: Vladislav Shpilevoy Message-ID: <20210414232224.GA325576@tarantool.org> References: <20210413165753.GA185709@tarantool.org> <0bcee380-6112-d466-fb1c-b1e8a62205c2@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <0bcee380-6112-d466-fb1c-b1e8a62205c2@tarantool.org> X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480B1C8842CE613979723F2FB4628545A35182A05F538085040CF57DA30FE98FFA07910B19D46BC4F9B673BEE1FFD623789FE4B304482FA23D1 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F12ABE79F2AB44EAEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006370FDF1CE57EA9D07C8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B249C078FFAB4AA03158607B5A88A127B70E47C10036089472D2E47CDBA5A96583C09775C1D3CA48CF53FA85A707D24CADCC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C07C37DE3F426B52F18941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD26923F8577A6DFFEA7C910E47378E270D9B7B076A6E789B0E97A8DF7F3B2552694A1E7802607F20496D49FD398EE364050F0AC5B80A05675ACD7AAF5A6EB0CB4C2AB3661434B16C20AC78D18283394535A9E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B62CFFCC7B69C47339089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2368A440D3B0F6089093C9A16E5BC824A2A04A2ABAA09D25379311020FFC8D4AD48C8163CD7E2ABE7318C54FF01DBFD37 X-C1DE0DAB: 0D63561A33F958A52EC14ED2307FBAE461A1AEAED2C705484D4FB4515BAAF33AD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34B0359B88B232A0C66E5220C35108FE7B037B6B06220424639FE3459980A213F6DE6B70EB5BD6ED191D7E09C32AA3244C345A72A6BFC8322857EC0F2329FA29C3A8CE788DE6831205FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojrcJA+pXcDun2lOvFx7ZzWA== X-Mailru-Sender: 5C3750E245F362008BC1685FEC6306ED7A7D588CDF80F40D7910B19D46BC4F9B21401CF93FD6FA555105BD0848736F9966FEC6BF5C9C28D97E07721503EA2E00ED97202A5A4E92BF7402F9BA4338D657ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v5 18/52] sql: introduce mem_concat() 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: Mergen Imeev via Tarantool-patches Reply-To: Mergen Imeev Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thank you for the review! My answer and diff below. On Thu, Apr 15, 2021 at 01:04:27AM +0200, Vladislav Shpilevoy wrote: > Thanks for the discussion! > > >>> diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c > >>> index b417c1007..2d76ef88d 100644 > >>> --- a/src/box/sql/mem.c > >>> +++ b/src/box/sql/mem.c > >>> @@ -326,6 +326,70 @@ mem_move(struct Mem *to, struct Mem *from) > >>> return 0; > >>> } > >>> > >>> +static bool > >>> +is_result_null(const struct Mem *a, const struct Mem *b, struct Mem *result, > >>> + enum field_type type) > >> > >> 1. Functions called 'is_*' never should change anything. > >> > > Fixed. Renamed to check_result_null(). > > > >> Another question is why do you even need it? It is used in a single place, > >> where it could be just inlined. And is not used in a place, where it could > >> be applied. > >> > > I added it here since it was the first commit, which used it. This functions > > will be used in all arithmetic and bitwise operations with two operands. > > I hope it is not too late to rename it to try_return_null()? Because > sorry, but 'check' also has a meaning - it is just like 'is' (does not > change anything), but sets a diag. At least this is what I see in the > code usually, and try to force in the new patches. Fixed, thank you! Also fixed in next patches. diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c index e06f964bd..2f2f859e3 100644 --- a/src/box/sql/mem.c +++ b/src/box/sql/mem.c @@ -182,8 +182,8 @@ mem_move(struct Mem *to, struct Mem *from) } static bool -check_result_null(const struct Mem *a, const struct Mem *b, struct Mem *result, - enum field_type type) +try_return_null(const struct Mem *a, const struct Mem *b, struct Mem *result, + enum field_type type) { mem_clear(result); result->field_type = type; @@ -195,7 +195,7 @@ mem_concat(struct Mem *a, struct Mem *b, struct Mem *result) { assert(result != b); if (a != result) { - if (check_result_null(a, b, result, FIELD_TYPE_STRING)) + if (try_return_null(a, b, result, FIELD_TYPE_STRING)) return 0; } else { if (((a->flags | b->flags) & MEM_Null) != 0) {