1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cov: eliminate dead code

Deduplicate code and also drop some warn about dead code.
This commit is contained in:
Zdenek Kabelac 2024-05-07 15:21:19 +02:00
parent 09f70dbb87
commit cfcbf89ed0

View File

@ -2942,6 +2942,11 @@ static void _out_prefix(unsigned depth)
} }
} }
static void _out_string_delim(int attr)
{
_out_string(attr ? ", " : " [");
}
/* /*
* Display tree * Display tree
*/ */
@ -2958,22 +2963,22 @@ static void _display_tree_attributes(struct dm_tree_node *node)
return; return;
if (_tree_switches[TR_ACTIVE]) { if (_tree_switches[TR_ACTIVE]) {
_out_string(attr++ ? ", " : " ["); _out_string_delim(attr++);
_out_string(info->suspended ? "SUSPENDED" : "ACTIVE"); _out_string(info->suspended ? "SUSPENDED" : "ACTIVE");
} }
if (_tree_switches[TR_RW]) { if (_tree_switches[TR_RW]) {
_out_string(attr++ ? ", " : " ["); _out_string_delim(attr++);
_out_string(info->read_only ? "RO" : "RW"); _out_string(info->read_only ? "RO" : "RW");
} }
if (_tree_switches[TR_OPENCOUNT]) { if (_tree_switches[TR_OPENCOUNT]) {
_out_string(attr++ ? ", " : " ["); _out_string_delim(attr++);
(void) _out_int((unsigned) info->open_count); (void) _out_int((unsigned) info->open_count);
} }
if (_tree_switches[TR_UUID]) { if (_tree_switches[TR_UUID]) {
_out_string(attr++ ? ", " : " ["); _out_string_delim(attr++);
_out_string(uuid && *uuid ? uuid : ""); _out_string(uuid && *uuid ? uuid : "");
} }