From patchwork Thu Mar 20 09:43:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Pandit X-Patchwork-Id: 3864671 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E073DBF540 for ; Thu, 20 Mar 2014 09:43:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 246F720218 for ; Thu, 20 Mar 2014 09:43:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D8B6720125 for ; Thu, 20 Mar 2014 09:43:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933231AbaCTJnl (ORCPT ); Thu, 20 Mar 2014 05:43:41 -0400 Received: from nbl-ex10-fe02.nebula.fi ([188.117.32.122]:31946 "EHLO ex10.nebula.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933129AbaCTJnj (ORCPT ); Thu, 20 Mar 2014 05:43:39 -0400 Received: from hercules.tuxera.com (194.100.106.167) by ex10.nebula.fi (188.117.32.115) with Microsoft SMTP Server (TLS) id 14.3.174.1; Thu, 20 Mar 2014 11:43:36 +0200 Date: Thu, 20 Mar 2014 11:43:35 +0200 From: Rakesh Pandit To: Subject: [PATCH] Btrfs-progs: btrfs: remove dead code in handle_options Message-ID: <20140320094334.GA10167@hercules.tuxera.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [194.100.106.167] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Just cleanup: remove useless return type, while loop and dead code. Signed-off-by: Rakesh Pandit --- 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 = {