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 C218C6C7D4; Wed, 3 Feb 2021 01:15:14 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C218C6C7D4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1612304114; bh=howJVhcfcEYM0JRr/LMT+HJF+K7Z1cLrlYuY+cqcSHw=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=sYW+2oqS8Axg7iK+aH2nqEGe5QwQiGWC2iJQnF50Nfiz6g/oQ0dZY/XLXgfX8iYEa v5hPlpAHA3yC88dmNPQGEeNwxnzDJFeTJz6668dLBALeUvZoVekp6HfzaMck1TpE/i 7ul638lwjK5MAZz3dQpT1rXEBSPdp1AsX9YMqG3E= Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 9F426632E1 for ; Wed, 3 Feb 2021 01:13:25 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9F426632E1 Received: by mail-lf1-f47.google.com with SMTP id m22so30377935lfg.5 for ; Tue, 02 Feb 2021 14:13:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7RpE+KHO6JMMkKGgrf1wqSjyVJf4zyBX37ZhDeUvueo=; b=f4EqOqM57hGhNglhvJmrGGu1ZkKDcsSuCIKPY+GeFJiVxheQS/PML3rrn0cqKk7L4K W+iYVdCxsJYzrPY4rbSc6swPrVdQGRU6fvWC6d7wR2E3VTkPhu1xrmG+zQI6ZRXFfyQD eNucw4EUGlmowTYe7HqmjLYFXn6hTo5MkmcnuxmwzY4KBRJhKSqVlz0AN32edkAojCvX FW23Ffzr2m/RlHyLTfewcrbkgXiuN34NyQFevImPO+kjkqH2EGLtGKBn0pslRQars+GW wJAB2N0LePMvyr+Q/onWQI1ruxqUHXAdvq8HrbFG2Kzr1WSMp3wG3/OMnpGJIYh0fP+K CcZg== X-Gm-Message-State: AOAM533W5I9S1sGGxWM7PPx4MTS+BoVso7jK3VILy722OaFMv+u1R2ha CUbGBtBnBZtnXj2xEqEE4rDIr1Lp0Cw= X-Google-Smtp-Source: ABdhPJzUX+jLzFsVK97e2z0JAVvD+IMyJIWt6jn9o7wYllKmpnAuv14+xeaY/yGMWXAQdEsK/bxeJw== X-Received: by 2002:ac2:545c:: with SMTP id d28mr42330lfn.446.1612304004525; Tue, 02 Feb 2021 14:13:24 -0800 (PST) Received: from grain.localdomain ([5.18.103.226]) by smtp.gmail.com with ESMTPSA id k125sm30271lfd.127.2021.02.02.14.13.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Feb 2021 14:13:23 -0800 (PST) Received: by grain.localdomain (Postfix, from userid 1000) id 9162F56029F; Wed, 3 Feb 2021 01:12:08 +0300 (MSK) To: tml Date: Wed, 3 Feb 2021 01:12:01 +0300 Message-Id: <20210202221207.383101-7-gorcunov@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210202221207.383101-1-gorcunov@gmail.com> References: <20210202221207.383101-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v14 06/12] module_cache: module_reload - drop redundant parameter 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: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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 --- 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