diff mbox

[2/3] btrfs-progs: cleanup cmd_device_usage

Message ID 0000e758dcc9eee7e01c6e19e417f2b393d9e42c.1447063147.git.zhaolei@cn.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

Zhaolei Nov. 9, 2015, 9:59 a.m. UTC
1: Remove more_than_one variant, use iterator's value instead
2: Remove "out" mark, use break instead.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 cmds-device.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

David Sterba Nov. 13, 2015, 4:49 p.m. UTC | #1
On Mon, Nov 09, 2015 at 05:59:38PM +0800, Zhao Lei wrote:
> 1: Remove more_than_one variant, use iterator's value instead
> 2: Remove "out" mark, use break instead.
> 
> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;
 }