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 749BA6EC5F; Tue, 2 Mar 2021 00:24:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 749BA6EC5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1614633864; bh=4jdAnV2gxILOC1cGnshaTbymVAFRPTISOo67Ba5oWr8=; 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=w3aeY3pKve5TRCoz2o0nBAHb8geQagwo2vjhqiAZ/ThmMCcHe6+jGZ+/XF18W9GzB kK50lgaLRwjLlYeIClLVAV7VgIhYTjRJ3qMOl39GQ32WLvGHuSDKJLtjt21C/pmCKY a3QlTfmtlc9i9/9Vr+eWj0LN+HeEY8V+apMwWSws= Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (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 0A1AF6EC5F for ; Tue, 2 Mar 2021 00:24:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0A1AF6EC5F Received: by mail-lf1-f54.google.com with SMTP id f1so27885610lfu.3 for ; Mon, 01 Mar 2021 13:24:02 -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=F5f6kImRbbcRZXi+cKlgwxinGRAT7cnAON1aiGIQzUY=; b=YwYMag2uQVp/ukc0Mdx7YMWXU3DAEQkjOFZCQwDz8++wzC1wvsROjtAkQYhxFdKc/B 3YaD6mfYMMj9JiOS+lkP0vh2mZ0yqTnSTFKouvw7quQXR0CCsCqn9uho9bLKlaQdXyZe IlR/kVT8xmVbdR3fkqo5DdMwiu5allvLfonsNOvuxAbF3mU0RM4ahT1TwRTjnRTDK9M1 ZjyyIQpss5mKBdcXcImjLUoeQX8aQhw6nlBbDYqh2v+lVr2xbTSkbK4ohDXT35zWI2no +j5fRvKYYhRozmrf5Bx6T8cx4/smmgm6AVoslpKV/5q/70jYolI0PXm7ejwYhAcwQh12 3iuQ== X-Gm-Message-State: AOAM530ll8L3Nyo6ct6oVDiPZvIa5J6jUM0HzJzB4XGrTducyGngaXlq Qg8tN8y0sTdz9gZV1pLlgHC3pq9S/YpRYQ== X-Google-Smtp-Source: ABdhPJxRHgMRACapt5iLecVHQ6G9kYDRVfs3O8kxfhA6/ivA2OCh1S6v6WklbF3ixKLXezgWbax9eg== X-Received: by 2002:a05:6512:1053:: with SMTP id c19mr10202509lfb.518.1614633840741; Mon, 01 Mar 2021 13:24:00 -0800 (PST) Received: from grain.localdomain ([5.18.171.94]) by smtp.gmail.com with ESMTPSA id p9sm2263451ljn.16.2021.03.01.13.23.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Mar 2021 13:23:58 -0800 (PST) Received: by grain.localdomain (Postfix, from userid 1000) id 04DCA560082; Tue, 2 Mar 2021 00:23:46 +0300 (MSK) To: tml Date: Tue, 2 Mar 2021 00:23:38 +0300 Message-Id: <20210301212343.422372-2-gorcunov@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210301212343.422372-1-gorcunov@gmail.com> References: <20210301212343.422372-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v19 1/6] 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: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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 --- 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" */ -- 2.29.2