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 E5CD06EC5E; Fri, 2 Apr 2021 15:35:26 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E5CD06EC5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617366926; bh=fx8mgG5WubYg/XinlT5Nbrbhk042NwGXwl8y8NwnQg4=; 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=juViZ297aNKByMrBdM7FSsBL/NisYKyCgIZR5upsPgps+3sv+f4uKogdupX1r/q+U kdyvIllh8eqJAMR6e72sd/gE0c9OcRHp0uU4+hOaShQHiF+tE3sqFsYVioWTevu0bG AiJqLc8QbVMzTCHZaO9KX4ocRWQn/lg58yKEyXqI= 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 A15CA6EC5E for ; Fri, 2 Apr 2021 15:34:49 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A15CA6EC5E Received: by mail-lf1-f47.google.com with SMTP id g8so7359638lfv.12 for ; Fri, 02 Apr 2021 05:34:49 -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=BVIGT2b4wcpePGNGy5J6n7/hel89669VxeXONuIt+CU=; b=uPcrpcN9hwffkCakihlbxntXM6lXBmfiRFl8Al7viUtP2FeMRVTRM1G+e9vFKwXA2b gudFoTEwAKRKs/xCidMxM8PoekB54HxAZkqowItBc0x/Jxf4PhcKtA6vmlBi5iBpcY8L zpiCK/a3nCezTj3QEH1TwK8zilowdWhyFgi/pRbuGOwn29RiqZfxP6cKGyrhsGQ6rVLt BZVxPd0dfH1nmICuOju+ibWbbfUo0kYN6kICX4muRetWnAcgccIhZSFJ/7y7Z4s+6qVE jkl+1FeLCinYbr8YohffqCNoTdPiY471K+lgf0FohbTLWyHyc7qqCXLlnK7gG7Iu8Nuk 2Cjw== X-Gm-Message-State: AOAM533WZ+NHO/P4ATcQHELKvVq9i0oOX3jswK4t2GmNHMk/2vedtruy ycNSiV+0/rHbt20pDZ6KruVIIy/oUW8mCA== X-Google-Smtp-Source: ABdhPJzR/iaa1I7g4VjVDrYWTGPq8QbvBu5j6t9YiGIyGD3ABz2xXcI32LmZ5FskfBO9t26uWSRY2Q== X-Received: by 2002:ac2:5f9b:: with SMTP id r27mr8264731lfe.607.1617366888565; Fri, 02 Apr 2021 05:34:48 -0700 (PDT) Received: from grain.localdomain ([5.18.171.94]) by smtp.gmail.com with ESMTPSA id l29sm849248lfp.63.2021.04.02.05.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Apr 2021 05:34:47 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 215A75601D6; Fri, 2 Apr 2021 15:34:22 +0300 (MSK) To: tml Date: Fri, 2 Apr 2021 15:34:15 +0300 Message-Id: <20210402123420.885834-3-gorcunov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210402123420.885834-1-gorcunov@gmail.com> References: <20210402123420.885834-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v20 2/7] 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.30.2