btrfs-progs: simplify string separator checks in sprint_profiles
We don't need an extra variable to track if there's already some output in the buffer. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
512a45dad2
commit
297df4f01a
|
@ -1726,7 +1726,6 @@ static int bit_count(u64 x)
|
|||
static char *sprint_profiles(u64 profiles)
|
||||
{
|
||||
int i;
|
||||
bool first = true;
|
||||
int maxlen = 1;
|
||||
char *ptr;
|
||||
|
||||
|
@ -1744,13 +1743,12 @@ static char *sprint_profiles(u64 profiles)
|
|||
if (!(btrfs_raid_array[i].bg_flag & profiles))
|
||||
continue;
|
||||
|
||||
if (!first)
|
||||
if (ptr[0])
|
||||
strcat(ptr, ", ");
|
||||
strcat(ptr, btrfs_raid_array[i].raid_name);
|
||||
first = false;
|
||||
}
|
||||
if (profiles & BTRFS_AVAIL_ALLOC_BIT_SINGLE) {
|
||||
if (!first)
|
||||
if (ptr[0])
|
||||
strcat(ptr, ", ");
|
||||
strcat(ptr, btrfs_raid_array[BTRFS_RAID_SINGLE].raid_name);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue