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 0E7066EC5D; Mon, 5 Apr 2021 13:26:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0E7066EC5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617618367; bh=8vHq9TdsdQBoCasGt/TI2TSxN8hhn6x++0pjpkMZJRI=; 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=mRD1gSwDd9ZfKUs5IbsqAP6N3JicErL2t+NNc5mmXbvA/H/CnQ1l4vRkh/Xu0o0Rl Jp16IxBnwakVB5ADL9+tR3Kp/fTDb9KBbXOG0yOce5khLABn8FBXajj22ztyXjcSqf DAcqkMRBbFSzjTTNZIyhYIetG1NkozhnCt0CKeHM= Received: from smtp36.i.mail.ru (smtp36.i.mail.ru [94.100.177.96]) (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 949766EC5D for ; Mon, 5 Apr 2021 13:26:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 949766EC5D Received: by smtp36.i.mail.ru with esmtpa (envelope-from ) id 1lTMQm-00048W-Uk; Mon, 05 Apr 2021 13:26:05 +0300 To: Cyrill Gorcunov , tml Cc: Vladislav Shpilevoy References: <20210402123420.885834-1-gorcunov@gmail.com> <20210402123420.885834-3-gorcunov@gmail.com> Message-ID: <86272ef6-4e54-9e12-5107-37d643e46954@tarantool.org> Date: Mon, 5 Apr 2021 13:26: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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: ru X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E3294CA3588DDE0233B0D17711AF1EA2D7DB9182A05F5380850402568CEEC6ECE13C771DA01B32F418BA1D58C67EEB58DAAB10B31746EC36FFF4C X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7CE54A8686262D0D1EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006378B49D47CE295E66E8638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95C16EE06F5A270FE6A7A655467C9A6C455A2BA4444B915F327A471835C12D1D9774AD6D5ED66289B5259CC434672EE6371117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658359CC434672EE6371117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CFF05F678DE7EF82F1BA3038C0950A5D36C8A9BA7A39EFB766EC990983EF5C0329BA3038C0950A5D36D5E8D9A59859A8B6CEA38C397FF6A29276E601842F6C81A1F004C906525384307823802FF610243DF43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7CCD707CD2FC7B787D43847C11F186F3C59DAA53EE0834AAEE X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24A6D60772A99906F8E1CD14B953EB46DFE767308A1C7605C355D89D7DBCDD132 X-C1DE0DAB: 0D63561A33F958A56E42DDA13E31B10B061D7462F48CDA3CB927FDAC79547704D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3441661D6226BE8C31E2075A5B64503C5187FB5F4B0A7AD78B8B6BB8A988C1096619D2DB4DC7DEB19E1D7E09C32AA3244CD3B4CE7F9553235286D6111EE447E922259227199D06760AFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojM00ve/f+0onhBz/el11nmw== X-Mailru-Sender: 583F1D7ACE8F49BDD2846D59FC20E9F827091A6BE31D1015CDEECCF1C99F9833803A2BCD899A9036424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 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 Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 05.04.2021 13:23, Serge Petrenko via 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. typo: simply -> simplify >> >> 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