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 0E7FF686CB; Fri, 5 Feb 2021 21:57:41 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0E7FF686CB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1612551461; bh=oZdvOxajTiZ5XBNPnosVuWjqCvsQ5p+jFapc1pzAWY0=; 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=f2bof8Zauc7HkYqUL5i7GaeJoex+u09ZFkWxx+5WxF/ASu5X0i28/4EDcEFqZ114A Qef586M/ywRaH6kcm/FeVV20GITaNL8VQ4FCHHzwrVVp5+QVlMkLiukLM+Q+Uqy7jg YIUjprSZ6uSdDNqggm8BnkmXiv4MJsl5uK4dVwMg= Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (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 1175564679 for ; Fri, 5 Feb 2021 21:55:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1175564679 Received: by mail-lj1-f170.google.com with SMTP id f2so8960046ljp.11 for ; Fri, 05 Feb 2021 10:55:51 -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=AjCDC2w7uOq5VV9jfkq+v2NFhWpBl35fwuRKkxQnUGw=; b=DWsTyjWdSlw2TRK6FgbOP+4baRGqzHGuU2bkYcCg0t3pt1BtI+2Zh0RKdg+OXA3JhQ fY/dIK9B6OIS2TXGIfoh+Jc6/2losDBcMv3oz8mbT2ChhfKx/yPh6U4GN+2uQ9tJuQk4 wu5+fey5as3BSJ5XdYVg0hLOWF+mqOzec5sS6fy+ACy4Fl0FyM6hjEoGCO320oY5SlYB 0KPfo1LaX/Wn9hm2LlG9wFmZ5PJQfHPeXM0WY6BBN4vaZh3Gcgnl/aDl5wovgUpr/wYc zTbrBX96Kq1dYE8dNQ3hz1glwPax2CeCwjnDp6OZktz/DdVXhfOaAe4PLdDKLRaGjTWJ 2bjQ== X-Gm-Message-State: AOAM5309jeTaUYLifqY0RwFdR6iAadTsRAhcYcYwnrsh6y2USnCJkAUk Do8GBKvHS/wKmRUsbooH5nU= X-Google-Smtp-Source: ABdhPJwXNP19/+2imetJgOCz4Cc+wWhQxjku3MCMWPwOonLUydPU3qYBwbDD5/SaJD8nW+apKZ6ecA== X-Received: by 2002:a2e:5802:: with SMTP id m2mr3497043ljb.145.1612551350684; Fri, 05 Feb 2021 10:55:50 -0800 (PST) Received: from grain.localdomain ([5.18.103.226]) by smtp.gmail.com with ESMTPSA id r5sm1128989ljc.81.2021.02.05.10.55.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 10:55:49 -0800 (PST) Received: by grain.localdomain (Postfix, from userid 1000) id 89700560293; Fri, 5 Feb 2021 21:54:37 +0300 (MSK) To: tml Date: Fri, 5 Feb 2021 21:54:31 +0300 Message-Id: <20210205185436.638894-7-gorcunov@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210205185436.638894-1-gorcunov@gmail.com> References: <20210205185436.638894-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v15 06/11] 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: Mons Anderson , 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 f606ec327..3fc8261e2 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