From: Cyrill Gorcunov via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: tml <tarantool-patches@dev.tarantool.org> Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Subject: [Tarantool-patches] [PATCH v14 06/12] module_cache: module_reload - drop redundant parameter Date: Wed, 3 Feb 2021 01:12:01 +0300 [thread overview] Message-ID: <20210202221207.383101-7-gorcunov@gmail.com> (raw) In-Reply-To: <20210202221207.383101-1-gorcunov@gmail.com> There is no need to return new module pointer, it is only used in a caller code to find if there was no such module at all. Instead call diag_set by self and drop this useless argument. Part-of #4642 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> --- src/box/call.c | 10 ++-------- src/box/module_cache.c | 9 +++------ src/box/module_cache.h | 4 +--- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/box/call.c b/src/box/call.c index 9c291260e..2a1a2c5bb 100644 --- a/src/box/call.c +++ b/src/box/call.c @@ -128,14 +128,8 @@ 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/module_cache.c b/src/box/module_cache.c index 60af290ae..4c64a6dc5 100644 --- a/src/box/module_cache.c +++ b/src/box/module_cache.c @@ -473,14 +473,12 @@ module_sym_call(struct module_sym *mod_sym, struct port *args, } 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_cache_find(package, package_end); if (old == 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_load(package, package_end); @@ -514,7 +512,6 @@ module_reload(const char *package, const char *package_end, } module_gc(old); - *module = new; return 0; restore: diff --git a/src/box/module_cache.h b/src/box/module_cache.h index 0d56aea92..fa62628c3 100644 --- a/src/box/module_cache.h +++ b/src/box/module_cache.h @@ -112,13 +112,11 @@ module_sym_call(struct module_sym *mod_sym, struct port *args, * * @param package shared library path start. * @param package_end shared library path end. - * @param[out] module pointer to the reloaded module. * * @return 0 on succes, -1 otherwise, diag is set. */ int -module_reload(const char *package, const char *package_end, - struct module **module); +module_reload(const char *package, const char *package_end); /** * Initialize modules subsystem. -- 2.29.2
next prev parent reply other threads:[~2021-02-02 22:15 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-02 22:11 [Tarantool-patches] [PATCH v14 00/12] box: implement cmod Lua module Cyrill Gorcunov via Tarantool-patches 2021-02-02 22:11 ` [Tarantool-patches] [PATCH v14 01/12] box/func: factor out c function entry structure Cyrill Gorcunov via Tarantool-patches 2021-02-02 22:11 ` [Tarantool-patches] [PATCH v14 02/12] module_cache: move module handling into own subsystem Cyrill Gorcunov via Tarantool-patches 2021-02-02 22:11 ` [Tarantool-patches] [PATCH v14 03/12] module_cache: direct update a cache value on reload Cyrill Gorcunov via Tarantool-patches 2021-02-02 22:11 ` [Tarantool-patches] [PATCH v14 04/12] module_cache: rename calls to ref in module structure Cyrill Gorcunov via Tarantool-patches 2021-02-02 22:12 ` [Tarantool-patches] [PATCH v14 05/12] module_cache: add comment about weird resolving Cyrill Gorcunov via Tarantool-patches 2021-02-02 22:12 ` Cyrill Gorcunov via Tarantool-patches [this message] 2021-02-02 22:12 ` [Tarantool-patches] [PATCH v14 07/12] module_cache: use references as a main usage counter Cyrill Gorcunov via Tarantool-patches 2021-02-02 22:12 ` [Tarantool-patches] [PATCH v14 08/12] module_cache: make module to carry hash it belongs to Cyrill Gorcunov via Tarantool-patches 2021-02-02 22:12 ` [Tarantool-patches] [PATCH v14 09/12] module_cache: use own hash for box.schema.func requests Cyrill Gorcunov via Tarantool-patches 2021-02-02 22:12 ` [Tarantool-patches] [PATCH v14 10/12] module_cache: provide module_load/unload calls Cyrill Gorcunov via Tarantool-patches 2021-02-02 22:12 ` [Tarantool-patches] [PATCH v14 11/12] box/cmod: implement cmod Lua module Cyrill Gorcunov via Tarantool-patches 2021-02-02 22:12 ` [Tarantool-patches] [PATCH v14 12/12] test: box/cfunc -- add cmod test Cyrill Gorcunov via Tarantool-patches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210202221207.383101-7-gorcunov@gmail.com \ --to=tarantool-patches@dev.tarantool.org \ --cc=gorcunov@gmail.com \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v14 06/12] module_cache: module_reload - drop redundant parameter' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox