All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rakesh Pandit <rakesh@tuxera.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH] Btrfs-progs: btrfs: remove dead code in handle_options
Date: Thu, 20 Mar 2014 11:43:35 +0200	[thread overview]
Message-ID: <20140320094334.GA10167@hercules.tuxera.com> (raw)

Just cleanup: remove useless return type, while loop and dead code.

Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
---
 btrfs.c | 33 +++++++++++----------------------
 1 file changed, 11 insertions(+), 22 deletions(-)

diff --git a/btrfs.c b/btrfs.c
index 16458ef..25257b6 100644
--- a/btrfs.c
+++ b/btrfs.c
@@ -212,31 +212,20 @@ static int cmd_version(int argc, char **argv)
 	return 0;
 }
 
-static int handle_options(int *argc, char ***argv)
+static void handle_options(int *argc, char ***argv)
 {
-	char **orig_argv = *argv;
-
-	while (*argc > 0) {
+	if (*argc > 0) {
 		const char *arg = (*argv)[0];
-		if (arg[0] != '-')
-			break;
-
-		if (!strcmp(arg, "--help")) {
-			break;
-		} else if (!strcmp(arg, "--version")) {
-			break;
-		} else {
-			fprintf(stderr, "Unknown option: %s\n", arg);
-			fprintf(stderr, "usage: %s\n",
-				btrfs_cmd_group.usagestr[0]);
-			exit(129);
-		}
-
-		(*argv)++;
-		(*argc)--;
+		if (arg[0] != '-' ||
+		    !strcmp(arg, "--help") ||
+		    !strcmp(arg, "--version"))
+			return;
+		fprintf(stderr, "Unknown option: %s\n", arg);
+		fprintf(stderr, "usage: %s\n",
+			btrfs_cmd_group.usagestr[0]);
+		exit(129);
 	}
-
-	return (*argv) - orig_argv;
+	return;
 }
 
 static const struct cmd_group btrfs_cmd_group = {
-- 
1.8.5.3


                 reply	other threads:[~2014-03-20  9:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140320094334.GA10167@hercules.tuxera.com \
    --to=rakesh@tuxera.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.