aboutsummaryrefslogtreecommitdiffstats
path: root/cmds-device.c
diff options
context:
space:
mode:
authorZhao Lei <zhaolei@cn.fujitsu.com>2015-11-09 17:59:38 +0800
committerDavid Sterba <dsterba@suse.com>2015-11-16 14:23:45 +0100
commit0ca4cd99a50cfe942701fa915f34b6543a89bc98 (patch)
tree4b24ce2f4ae4883795c161f0899fe7eba870640b /cmds-device.c
parentf5d6833768f9e627025b4b4cf13581775b69711e (diff)
downloadbtrfs-progs-0ca4cd99a50cfe942701fa915f34b6543a89bc98.tar.gz
btrfs-progs-0ca4cd99a50cfe942701fa915f34b6543a89bc98.tar.xz
btrfs-progs-0ca4cd99a50cfe942701fa915f34b6543a89bc98.zip
btrfs-progs: cleanup cmd_device_usage, simplify loop checks
1: Remove more_than_one variable, use iterators value instead 2: Remove "out" label, we use break instead. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> [ changelog update ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-device.c')
-rw-r--r--cmds-device.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/cmds-device.c b/cmds-device.c
index 034d0d7..efe5b4c 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;
}