From patchwork Mon Nov 9 09:59:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaolei X-Patchwork-Id: 7581981 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 136EDC05C6 for ; Mon, 9 Nov 2015 10:01:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3A2EF20600 for ; Mon, 9 Nov 2015 10:01:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9135E2064E for ; Mon, 9 Nov 2015 10:01:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752654AbbKIKBX (ORCPT ); Mon, 9 Nov 2015 05:01:23 -0500 Received: from cn.fujitsu.com ([59.151.112.132]:12000 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752029AbbKIKBW (ORCPT ); Mon, 9 Nov 2015 05:01:22 -0500 X-IronPort-AV: E=Sophos;i="5.20,242,1444665600"; d="scan'208";a="248074" Received: from bogon (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 09 Nov 2015 18:01:07 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id tA9A0enX031122 for ; Mon, 9 Nov 2015 18:00:40 +0800 Received: from localhost.localdomain (10.167.226.114) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server id 14.3.181.6; Mon, 9 Nov 2015 18:01:18 +0800 From: Zhao Lei To: CC: Zhao Lei Subject: [PATCH 2/3] btrfs-progs: cleanup cmd_device_usage Date: Mon, 9 Nov 2015 17:59:38 +0800 Message-ID: <0000e758dcc9eee7e01c6e19e417f2b393d9e42c.1447063147.git.zhaolei@cn.fujitsu.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <068f125cbb9037fbd06cf5db81db8ae4a22ae712.1447063147.git.zhaolei@cn.fujitsu.com> References: <068f125cbb9037fbd06cf5db81db8ae4a22ae712.1447063147.git.zhaolei@cn.fujitsu.com> MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 1: Remove more_than_one variant, use iterator's value instead 2: Remove "out" mark, use break instead. Signed-off-by: Zhao Lei --- cmds-device.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cmds-device.c b/cmds-device.c index e23ea61..739405b 100644 --- a/cmds-device.c +++ b/cmds-device.c @@ -487,7 +487,6 @@ static int cmd_device_usage(int argc, char **argv) { unsigned unit_mode; int ret = 0; - int more_than_one = 0; int i; unit_mode = get_unit_mode_from_arg(&argc, argv, 1); @@ -499,23 +498,22 @@ static int cmd_device_usage(int argc, char **argv) int fd; DIR *dirstream = NULL; - if (more_than_one) + if (i > 1) printf("\n"); fd = btrfs_open_dir(argv[i], &dirstream, 1); if (fd < 0) { ret = 1; - goto out; + break; } ret = _cmd_device_usage(fd, argv[i], unit_mode); close_file_or_dir(fd, dirstream); if (ret) - goto out; - more_than_one = 1; + break; } -out: + return !!ret; }