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 7878A6EC5B; Wed, 17 Feb 2021 23:16:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7878A6EC5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1613592960; bh=e0h4rnBOPLX3ZBCorjrIMhryXFC5JYp+1c6HnoZ/kd8=; 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=xZjqxyxVknEBoMIarrqD/Bal8jZ0BuSLzvFcShap5wgMDTxQ/NI1MCpcs3jWChx8+ UCrONfb5t91585dPqLgZpin2CUGp7vYQ1EiLsiS/Xe0rzseih/g+ZZRAHBON5htSqw i/tgMcwsDrDB6MIre/IViEbKZnuJN7ytWeQjQq0I= Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (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 6F45B6EC5B for ; Wed, 17 Feb 2021 23:15:41 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6F45B6EC5B Received: by mail-lf1-f43.google.com with SMTP id z11so23843100lfb.9 for ; Wed, 17 Feb 2021 12:15:41 -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=YvgBRRc93PHJc0n85973scVZXASCipRNk6c5VT/I5EY=; b=mz8mcpgWTvT+HDYqu/WH+lzzo/rVTJDqu3lPu128CGGb7kMLqDsUQdieeJv3uYW9py J/mTfxxWh+wCzcirnskmiXOOIg+lospFGJm1SQgCfnm+LQvpruGg6bopySgmduvAdP/8 L8XEcgehlqjMUJ8V8jNsxHQJu9NPXeELfVVPDhtsg/3yv6uN6bzAlj+YkpW6je7mpjy5 bfaQvRL8skpiiaZxDejCIISuM63RnjkfOEKFScCYGZdaARmF3h8Zr+BJSCiL/4oWJceU hoUWc7OYPfkRDdkvugCc+GI9fx6ZrhAuKOCc97qXUhoUMLxFs/WvzV3QBNvl9c+dHXkw d3pA== X-Gm-Message-State: AOAM5319jyu3aCVVy6TKX5/hsOVhCuikwk1EfVPUFszIFM6A7HzT1oG/ ivmJPtDcXPq1Cse2u1KM5IfKPiVLxT8= X-Google-Smtp-Source: ABdhPJyYlBLKzadEExDzjd9VZyhaLseCw6wlH+fZRm/Y9ysIvpLTbFa2kYEQ9yI5/WMmppAIdjHumQ== X-Received: by 2002:a05:6512:11d0:: with SMTP id h16mr356291lfr.660.1613592940400; Wed, 17 Feb 2021 12:15:40 -0800 (PST) Received: from grain.localdomain ([5.18.171.94]) by smtp.gmail.com with ESMTPSA id t7sm355560lfl.141.2021.02.17.12.15.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 12:15:39 -0800 (PST) Received: by grain.localdomain (Postfix, from userid 1000) id AFE1E56007A; Wed, 17 Feb 2021 23:15:25 +0300 (MSK) To: tml Date: Wed, 17 Feb 2021 23:15:18 +0300 Message-Id: <20210217201521.436951-2-gorcunov@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210217201521.436951-1-gorcunov@gmail.com> References: <20210217123945.396396-1-gorcunov@gmail.com> <20210217201521.436951-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 1/4] box/func: drop redundant module 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" This argument is only needed if there is no such module present. Just setup error inside module_reload function. Part-of #4642 Signed-off-by: Cyrill Gorcunov --- src/box/call.c | 11 +++-------- src/box/func.c | 8 +++----- src/box/func.h | 3 +-- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/box/call.c b/src/box/call.c index 9c291260e..bffd17c5a 100644 --- a/src/box/call.c +++ b/src/box/call.c @@ -128,14 +128,9 @@ 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; + if (module_reload(name, name + strlen(name)) != 0) + return -1; + return 0; } int diff --git a/src/box/func.c b/src/box/func.c index f77cf00f8..0d552652d 100644 --- a/src/box/func.c +++ b/src/box/func.c @@ -259,13 +259,12 @@ 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); @@ -286,7 +285,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 ac9772dfe..c6861df8e 100644 --- a/src/box/func.h +++ b/src/box/func.h @@ -112,12 +112,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