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 F25556EC5D; Mon, 5 Apr 2021 13:23:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F25556EC5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617618188; bh=oRNYYwjKPS7YRIoC9s77yWBRG1jByTVbVPW3ACWxcKs=; 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=yvhqC4FX5pxcqDA79FfAqXzrOxsAJTDt/CYm5epf/ygRvweMq7araBz7ZyTyDrddW BZY/E12djWYBCe++buG1VKPALvXCVvjd4R9fvX+NSWB6JET8xF/T8HPzLPDABwxY01 RMmFv+VYbhupGyJZPc0XTDOKoLU1MPT3p3+/PBdU= Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) (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 E03806EC5D for ; Mon, 5 Apr 2021 13:23:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E03806EC5D Received: by smtp48.i.mail.ru with esmtpa (envelope-from ) id 1lTMNs-00030a-Uy; Mon, 05 Apr 2021 13:23:05 +0300 To: Cyrill Gorcunov , tml References: <20210402123420.885834-1-gorcunov@gmail.com> <20210402123420.885834-3-gorcunov@gmail.com> Message-ID: Date: Mon, 5 Apr 2021 13:23:03 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <20210402123420.885834-3-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E3294DD38BE31D7797EF84C856624A09E4809182A05F5380850409449D88B5D31542371821CF6DFC3E959D7CD7B00DE21E4E778C3DA3F18831BEA X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7D3E352D4AD7EBF54EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006378D071468F2F69688EA1F7E6F0F101C67CDEEF6D7F21E0D1D174C73DBBBFC766418C37248141F33C2DADF1D6197BAB381CA4D74978635D878389733CBF5DBD5E913377AFFFEAFD269A417C69337E82CC2CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92A417C69337E82CC2CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249D8F32C8A2F72EAF876E601842F6C81A12EF20D2F80756B5F7E9C4E3C761E06A776E601842F6C81A127C277FBC8AE2E8B29285E2B17063EF73AA81AA40904B5D9DBF02ECDB25306B2201CA6A4E26CD07C3BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735BCC85A7874001769C4224003CC83647689D4C264860C145E X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C978310B8766D3E0A710FD7E6ED54993E2D80B X-C1DE0DAB: 0D63561A33F958A5B025E0F8EDD7A00537E02F661D28B388461A71EE16DCEBCED59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D345C064E16D8ABF335241FA1BAC9E3BE59697D44D61C4B753FB09C9221D8131BFE06B5E89AA9D97A231D7E09C32AA3244CC9A52B25D6A98B58F5466DD6CA90EA02D08D48398F32B4A6927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojM00ve/f+0olCihp0IH0M3A== X-Mailru-Sender: 583F1D7ACE8F49BDD2846D59FC20E9F835C4E89344FD16EA51C604271B2B2DA87A1FAD50085613C5424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v20 2/7] box/func: module_reload -- drop redundant argument 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: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Cc: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 02.04.2021 15:34, Cyrill Gorcunov пишет: > The only purpose of the module argument is to > notify the caller that the module doesn't exist. > Lets simply the code and drop this argument. > > Part-of #4642 > > Signed-off-by: Cyrill Gorcunov > --- Thanks for the patch! LGTM. > src/box/call.c | 9 +-------- > src/box/func.c | 7 +++---- > src/box/func.h | 3 +-- > 3 files changed, 5 insertions(+), 14 deletions(-) > > diff --git a/src/box/call.c b/src/box/call.c > index 9c291260e..7839e1f3e 100644 > --- a/src/box/call.c > +++ b/src/box/call.c > @@ -128,14 +128,7 @@ box_module_reload(const char *name) > user->def->name); > return -1; > } > - struct module *module = NULL; > - if (module_reload(name, name + strlen(name), &module) == 0) { > - if (module != NULL) > - return 0; > - else > - diag_set(ClientError, ER_NO_SUCH_MODULE, name); > - } > - return -1; > + return module_reload(name, name + strlen(name)); > } > > int > diff --git a/src/box/func.c b/src/box/func.c > index 9909cee45..233696a4f 100644 > --- a/src/box/func.c > +++ b/src/box/func.c > @@ -372,13 +372,13 @@ module_sym(struct module *module, const char *name) > } > > int > -module_reload(const char *package, const char *package_end, struct module **module) > +module_reload(const char *package, const char *package_end) > { > struct module *old_module = module_cache_find(package, package_end); > if (old_module == NULL) { > /* Module wasn't loaded - do nothing. */ > - *module = NULL; > - return 0; > + diag_set(ClientError, ER_NO_SUCH_MODULE, package); > + return -1; > } > > struct module *new_module = module_load(package, package_end); > @@ -399,7 +399,6 @@ module_reload(const char *package, const char *package_end, struct module **modu > if (module_cache_put(new_module) != 0) > goto restore; > module_gc(old_module); > - *module = new_module; > return 0; > restore: > /* > diff --git a/src/box/func.h b/src/box/func.h > index 581e468cb..0a08fa465 100644 > --- a/src/box/func.h > +++ b/src/box/func.h > @@ -113,12 +113,11 @@ func_call(struct func *func, struct port *args, struct port *ret); > * > * @param package name begin pointer. > * @param package_end package_end name end pointer. > - * @param[out] module a pointer to store module object on success. > * @retval -1 on error. > * @retval 0 on success. > */ > int > -module_reload(const char *package, const char *package_end, struct module **module); > +module_reload(const char *package, const char *package_end); > > #if defined(__cplusplus) > } /* extern "C" */ -- Serge Petrenko