[03/33] fix unused parameter warning in find_option()
diff mbox series

Message ID 20191017182121.103569-3-zenczykowski@gmail.com
State Accepted
Delegated to: John Linville
Headers show
Series
  • [01/33] fix arithmetic on pointer to void is a GNU extension warning
Related show

Commit Message

Maciej ┼╗enczykowski Oct. 17, 2019, 6:20 p.m. UTC
From: Maciej ┼╗enczykowski <maze@google.com>

This fixes:
  external/ethtool/ethtool.c:5417:28: error: unused parameter 'argc' [-Werror,-Wunused-parameter]
  static int find_option(int argc, char **argp)

Signed-off-by: Maciej ┼╗enczykowski <maze@google.com>
Change-Id: I7782cac5f58e217fc6032037a2f248b03573b9d4
---
 ethtool.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Patch
diff mbox series

diff --git a/ethtool.c b/ethtool.c
index 5e0deda..0f3fe7f 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -5507,7 +5507,7 @@  static int show_usage(struct cmd_context *ctx maybe_unused)
 	return 0;
 }
 
-static int find_option(int argc, char **argp)
+static int find_option(char *arg)
 {
 	const char *opt;
 	size_t len;
@@ -5517,8 +5517,7 @@  static int find_option(int argc, char **argp)
 		opt = args[k].opts;
 		for (;;) {
 			len = strcspn(opt, "|");
-			if (strncmp(*argp, opt, len) == 0 &&
-			    (*argp)[len] == 0)
+			if (strncmp(arg, opt, len) == 0 && arg[len] == 0)
 				return k;
 
 			if (opt[len] == 0)
@@ -5667,7 +5666,7 @@  static int do_perqueue(struct cmd_context *ctx)
 		ctx->argp++;
 	}
 
-	i = find_option(ctx->argc, ctx->argp);
+	i = find_option(ctx->argp[0]);
 	if (i < 0)
 		exit_bad_args();
 
@@ -5719,7 +5718,7 @@  int main(int argc, char **argp)
 	if (argc == 0)
 		exit_bad_args();
 
-	k = find_option(argc, argp);
+	k = find_option(*argp);
 	if (k >= 0) {
 		argp++;
 		argc--;