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 2C9AB6EC63; Thu, 8 Apr 2021 19:42:59 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2C9AB6EC63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617900179; bh=354lajgEDs6j73USENJvSFhrZz3wzz3ygNvfb5d/znE=; 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=JrTjU96MLYUFtlSKk4ni5psAamyl9TyNjN7Gad4h1+gqHHxa0WCs+973J92anI8Co m5KSACeJPt3PyI3YcsbLTODYO9C+0EdLcUAZqGtyRCUSUa0HnrQgaEwsUPKHdntB/l EQOrLNi9+fi1I5rkwOEyT/STcYDkWOe8ffnRXKVw= Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (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 2981A6EC5E for ; Thu, 8 Apr 2021 19:42:20 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2981A6EC5E Received: by mail-lf1-f41.google.com with SMTP id w28so5121554lfn.2 for ; Thu, 08 Apr 2021 09:42:20 -0700 (PDT) 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=cw/BdYK5zUmiRtLSCphHiHETs8yftlEjL1Kj3v3rdYk=; b=q07QvXaJNmfNnrgChX+BvfiP3qsTuyfBGX9CWcxAl5Aft9ZRNRLA9FlIxRH+D3wUvj KuNmv38s9JiW/St8Lt46p3M+9QU0oAny0Wrs32Gsh1UkxfXSj9ns+T+YZn6OfSegepR5 nCfm/IiBqGnzTIcref+g9uxLAvh52e3vXrMvLv4Q6uUYo7PQqXcs5kYhIuZn+Dx69B3y woU2JQZauGeY47bSPyqCdkRhpLGzoytgnbmPejDeYgENhwKGffzDJIIqdf7rUKDyHyeA 60PKHWhJVBvepVNQw9yriC8M18OwMdC8eFBlv1QizddtlMPw7E7M0ghVs5qjUCjcX+nw hvfg== X-Gm-Message-State: AOAM531OSPavhJJcotuLx0yP4jRvyzvi+igsiO3GgNXxHMGB6xCxh1Sf B3tTE2ctCQ3MixJbToQlpuedfA8zgS4= X-Google-Smtp-Source: ABdhPJyDGBDntd88kuRzLmqOuhrndjiHwiRZl4rvlg9f0CSvHydY5d7CVzh9KsNBUFpR4YgywgqtHA== X-Received: by 2002:ac2:4c11:: with SMTP id t17mr7005811lfq.107.1617900139117; Thu, 08 Apr 2021 09:42:19 -0700 (PDT) Received: from grain.localdomain ([5.18.199.94]) by smtp.gmail.com with ESMTPSA id f23sm2901079lja.43.2021.04.08.09.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 09:42:18 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 7DA865601F9; Thu, 8 Apr 2021 19:41:52 +0300 (MSK) To: tml Date: Thu, 8 Apr 2021 19:41:47 +0300 Message-Id: <20210408164151.1759348-3-gorcunov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210408164151.1759348-1-gorcunov@gmail.com> References: <20210408164151.1759348-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v21 2/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 simplify the code and drop this argument. Part-of #4642 Acked-by: Serge Petrenko 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 94b14c56c..5fdefe349 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); @@ -400,7 +400,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.30.2