From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id B3A6F5A0307 for ; Wed, 05 Jun 2024 02:42:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1717548164; bh=Pg73XssR3qREyFnWRZz2f2G4C8u2PztmxXKvlbH9wsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MMZ0qCOfim4m4/m9EoSc//e3J3bP19nr82suIQ/4XP7qEF0dQNdyZbkwaLzgUtBV5 PggqMV7IN8eb6l6BbBl41CrLi0wYjsycg39av+aROHCCLqFZYbQW4lemCZBuxOezfv 7R+kfxbVMKwkYw6ahZsxv9gB1qAi9q5U6CTQz9G1J9lIWB/VzAQ+x/rEouGCGxfptt E7IMxZnnv3+VsnR/gJenB2ZGhWY+hfUS4PgQ7hTxQsLN2F8gzJqrtXo+D1mESTqSZD HSpRQGk6Ob8OuaJrzirGSfHraGtTQMYW/ZHEp78HZDSP9qHi9wfzD1tRq/RgnHFaC4 +0736vLm1yhlA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Vv7wN6qCbz4x1T; Wed, 5 Jun 2024 10:42:44 +1000 (AEST) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v2 1/3] conf: Remove unhelpful usage() wrapper Date: Wed, 5 Jun 2024 10:42:40 +1000 Message-ID: <20240605004243.3330116-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240605004243.3330116-1-david@gibson.dropbear.id.au> References: <20240605004243.3330116-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: WXZFNLRP6XMDZDXI4CXJT2YQ2CR2HTWH X-Message-ID-Hash: WXZFNLRP6XMDZDXI4CXJT2YQ2CR2HTWH X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: erik.sjolund@gmail.com, David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: usage() does nothing but call print_usage() with EXIT_FAILURE as a parameter. It's no more complex to just give that parameter at the single call site. Eliminate it and rename print_usage() to just usage(). Signed-off-by: David Gibson --- conf.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/conf.c b/conf.c index 50383a39..f2a92574 100644 --- a/conf.c +++ b/conf.c @@ -704,11 +704,11 @@ static unsigned int conf_ip6(unsigned int ifi, } /** - * print_usage() - Print usage, exit with given status code + * usage() - Print usage, exit with given status code * @name: Executable name * @status: Status code for exit() */ -static void print_usage(const char *name, int status) +static void usage(const char *name, int status) { if (strstr(name, "pasta")) { info("Usage: %s [OPTION]... [COMMAND] [ARGS]...", name); @@ -897,15 +897,6 @@ pasta_opts: exit(status); } -/** - * usage() - Print usage and exit with failure - * @name: Executable name - */ -static void usage(const char *name) -{ - print_usage(name, EXIT_FAILURE); -} - /** * conf_print() - Print fundamental configuration parameters * @c: Execution context @@ -1647,11 +1638,11 @@ void conf(struct ctx *c, int argc, char **argv) break; case 'h': log_to_stdout = 1; - print_usage(argv[0], EXIT_SUCCESS); + usage(argv[0], EXIT_SUCCESS); break; case '?': default: - usage(argv[0]); + usage(argv[0], EXIT_FAILURE); break; } } while (name != -1); -- 2.45.1