From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp56.i.mail.ru (smtp56.i.mail.ru [217.69.128.36]) (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 98A46469719 for ; Fri, 16 Oct 2020 00:47:21 +0300 (MSK) From: "Timur Safin" References: <20201015213806.gfujc6qpd4utizf3@tkn_work_nb> In-Reply-To: <20201015213806.gfujc6qpd4utizf3@tkn_work_nb> Date: Fri, 16 Oct 2020 00:47:20 +0300 Message-ID: <053601d6a33c$c229c190$467d44b0$@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Language: ru Subject: Re: [Tarantool-patches] [PATCH 2.X v4 1/4] module api: export box_tuple_validate List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Alexander Turenko' Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org Thanks! Will update test(s) in the follow-up patchset, not now. Timur : From: Alexander Turenko : Subject: Re: [PATCH 2.X v4 1/4] module api: export box_tuple_validate : : LGTM for the patch. : : Just few notes, feel free to ignore. : : > +/* : > + * Validate tuple with format of single boolean field : > + */ : : Nits: /* -> /**; period at the end. : : > +static int : > +test_tuple_validate_formatted(lua_State *L) : > +{ : > + int valid = 0; : > + box_tuple_t *tuple = luaT_istuple(L, -1); : > + : > + if (tuple != NULL) { : > + uint32_t fields[] = { 0 }; : > + uint32_t types[] = { FIELD_TYPE_BOOLEAN }; : > + box_key_def_t *key_defs[] = { : > + box_key_def_new(fields, types, 1) : > + }; : > + assert(key_defs[0] != NULL); : > + struct tuple_format *format = : > + box_tuple_format_new(key_defs, 1); : > + assert(format); : > + : > + valid = box_tuple_validate(tuple, format) == 0; : : Nit: I would call box_tuple_format_unref() and box_key_def_delete(). : : I know, it is just test, so you can ignore this comment. I'm personally : a bit afraid of using bad patterns without a proper comment even in : tests. What if someone will copy it somewhere..?