diff mbox

Btrfs-progs: btrfs: remove dead code in handle_options

Message ID 20140320094334.GA10167@hercules.tuxera.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Rakesh Pandit March 20, 2014, 9:43 a.m. UTC
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 mbox

Patch

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 = {