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 973576EC40; Mon, 5 Jul 2021 09:31:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 973576EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1625466667; bh=MSWYsvPWrmTwC64PuTUp9GbTw7/z2SBAz2gAAY1jooA=; 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=evunBt/73VZFqPPnAqa9NtGcIhuwFjl+XxgJ2s9IDfPLfNqn8J+mzKQmohCS4smDf J5GDySBe09SsSmQZxgN7d+if8ubzm3G6JI5wfvid5gXFWQuEjn7TEZyZajh8fL5Tsx +sR8+C2lrrnq55QzrWzZMijcoVb7BsX2gsxhnqAU= Received: from smtp54.i.mail.ru (smtp54.i.mail.ru [217.69.128.34]) (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 0B9096EC40 for ; Mon, 5 Jul 2021 09:31:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0B9096EC40 Received: by smtp54.i.mail.ru with esmtpa (envelope-from ) id 1m0I8G-0007Bt-Oa; Mon, 05 Jul 2021 09:31:05 +0300 Date: Mon, 5 Jul 2021 09:30:37 +0300 To: Vladislav Shpilevoy Message-ID: <20210705063037.n5p7mvqyyg4bxi7a@tkn_work_nb> References: <98109d2e-4efd-1ee5-86e2-b2d1574653fa@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <98109d2e-4efd-1ee5-86e2-b2d1574653fa@tarantool.org> X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD954DFF1DC42D673FB703477AD6D36A6E3C7EF2853D6A1C7C1182A05F538085040F05BC43ED40CD14E01B4CA0FE53B2E53BA3A5AAAABECDC4F6247B208E09DC0C0 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE73F64378C139886A6EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063706922F90966A37BA8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D835BC6E5501AAC7EC5DA737482662AC12117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD182CC0D3CB04F14752D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EED76C6ED7039589DE287C8E22D4AE2A51D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3CF7CD7A0D5AA5F2503F1AB874ED89028C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637427B078F297B269AEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A51323ADF4C3A8F7CBF249AB4AF47A7BAFAFAFE3762B7F5AA0D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7569E77FCA7B33833F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D340297C696F996E38420E7FB47CEC0E1F54C63BEF1923754586A1E63819293FCFAC1FA994ED0A399F01D7E09C32AA3244CEED7D492BFFFD02725843FA24F3682DEE3D93501275E802F927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj5fH2RN9TpJl4oWEwv4iwHA== X-Mailru-Sender: FFAA8E4AEE17E37C3731A083A1A85ADE21FC1A8BA769522E1BA7CB5C8A3A2508B7EA9FE7735C3DBFC664A44C781FCEA7C77752E0C033A69EDF9F2CE1E9CF805D8CD356D4F938FF726C18EFA0BB12DBB0 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 1/4] lua: move serializer helpers into its own file 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: Alexander Turenko via Tarantool-patches Reply-To: Alexander Turenko Cc: Cyrill Gorcunov , tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Sun, Jul 04, 2021 at 03:10:00PM +0200, Vladislav Shpilevoy wrote: > Thanks for the patch! > > See 3 comments below. > > > diff --git a/src/lua/init.c b/src/lua/init.c > > index 93e93a103..ff11d202b 100644 > > --- a/src/lua/init.c > > +++ b/src/lua/init.c > > @@ -69,6 +69,10 @@ > > #include > > #include > > > > +/* Don't include the entire header only for *_init(). */ > > 1. But what is the problem with that? It would be simpler and > consistent with the other inits. It looks more accurate for me: acquire only what we actually use. Just like defining an opacue structure in C or using `from foo import bar` in Python. It is not the main reason for me, but it also can positively impact compilation time (less preprocessing). However, maybe, it would be more accurate to define a macro like LUA_MODULE_INIT_ONLY before including those headers and add #if conditions to them. Anyway, since it looks unusual for you, I'll stick with just #include . > > diff --git a/src/lua/serializer.c b/src/lua/serializer.c > > new file mode 100644 > > index 000000000..6c3dd73af > > --- /dev/null > > +++ b/src/lua/serializer.c > > @@ -0,0 +1,651 @@ > > <..stripped license text..> > > +#include > > +#include > > +#include /* modf, isfinite */ > > +#include > > +#include > > 2. These are already included in the header. And some of the others > below too. I discussed it once (a long time ago) with Vladimir D. He said that the rule of thumb is to include a header into a foo.c file if we use something from it: disregarding whether the header is included into foo.h or not. It looks meaningful for me: declare where use. I guess it'll ease future changes of only .c or only .h a bit. I'll leave it as is if you don't object. To be honest, #include directives management is a pain. If there is some good linter, I would integrate it into the project. > > diff --git a/src/lua/serializer.h b/src/lua/serializer.h > > new file mode 100644 > > index 000000000..54b0bc11a > > --- /dev/null > > +++ b/src/lua/serializer.h > > @@ -0,0 +1,344 @@ > > +#ifndef TARANTOOL_LUA_SERIALIZER_H_INCLUDED > > +#define TARANTOOL_LUA_SERIALIZER_H_INCLUDED > > 3. According to the code style, new files should use `#pragma once`. Changed. WBR, Alexander Turenko.