mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-04 22:18:13 +02:00
cli: minor cleanup in _print_data_cell_clear_text()
It wasn't entirely clear what this was doing. Like before, free and clear the text pointers. However, also always reset the text_format back to PLAIN.
This commit is contained in:
parent
9c51ebc298
commit
e912ca7622
1 changed files with 13 additions and 10 deletions
|
|
@ -936,18 +936,20 @@ _print_data_header_cell_clear (gpointer cell_p)
|
|||
static void
|
||||
_print_data_cell_clear_text (PrintDataCell *cell)
|
||||
{
|
||||
if (cell->text_to_free) {
|
||||
switch (cell->text_format) {
|
||||
case PRINT_DATA_CELL_FORMAT_TYPE_PLAIN:
|
||||
switch (cell->text_format) {
|
||||
case PRINT_DATA_CELL_FORMAT_TYPE_PLAIN:
|
||||
if (cell->text_to_free)
|
||||
g_free ((char *) cell->text.plain);
|
||||
break;
|
||||
case PRINT_DATA_CELL_FORMAT_TYPE_STRV:
|
||||
cell->text.plain = NULL;
|
||||
break;
|
||||
case PRINT_DATA_CELL_FORMAT_TYPE_STRV:
|
||||
if (cell->text_to_free)
|
||||
g_strfreev ((char **) cell->text.strv);
|
||||
break;
|
||||
};
|
||||
cell->text_to_free = FALSE;
|
||||
}
|
||||
memset (&cell->text, 0, sizeof (cell->text));
|
||||
cell->text.strv = NULL;
|
||||
break;
|
||||
};
|
||||
cell->text_format = PRINT_DATA_CELL_FORMAT_TYPE_PLAIN;
|
||||
cell->text_to_free = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1098,6 +1100,7 @@ _print_fill (const NmcConfig *nmc_config,
|
|||
cell->text.plain = "--";
|
||||
} else if (!cell->text.plain)
|
||||
cell->text.plain = "";
|
||||
nm_assert (cell->text_format == PRINT_DATA_CELL_FORMAT_TYPE_PLAIN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue