mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-06 09:55:46 +00:00
vsh-table: allow empty columns
Trivially implement this by deleting the bogus check in vshTableSafeEncode. Now it returns an empty string for an empty string instead of returning NULL without setting an error. Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
865b201479
commit
b419ea6a90
@ -291,7 +291,8 @@ testNTables(const void *opaque ATTRIBUTE_UNUSED)
|
|||||||
" Id Name Status\n"
|
" Id Name Status\n"
|
||||||
"--------------------------\n"
|
"--------------------------\n"
|
||||||
" 1 fedora28 running\n"
|
" 1 fedora28 running\n"
|
||||||
" 2 rhel7.5 running\n";
|
" 2 rhel7.5 running\n"
|
||||||
|
" 3 gazpacho \n";
|
||||||
const char *exp2 =
|
const char *exp2 =
|
||||||
" Id Name Status\n"
|
" Id Name Status\n"
|
||||||
"---------------------\n";
|
"---------------------\n";
|
||||||
@ -311,6 +312,7 @@ testNTables(const void *opaque ATTRIBUTE_UNUSED)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
vshTableRowAppend(table1, "1", "fedora28", "running", NULL);
|
vshTableRowAppend(table1, "1", "fedora28", "running", NULL);
|
||||||
vshTableRowAppend(table1, "2", "rhel7.5", "running", NULL);
|
vshTableRowAppend(table1, "2", "rhel7.5", "running", NULL);
|
||||||
|
vshTableRowAppend(table1, "3", "gazpacho", "", NULL);
|
||||||
act1 = vshTablePrintToString(table1, true);
|
act1 = vshTablePrintToString(table1, true);
|
||||||
|
|
||||||
table2 = vshTableNew("Id", "Name", "Status", NULL);
|
table2 = vshTableNew("Id", "Name", "Status", NULL);
|
||||||
|
@ -219,9 +219,6 @@ vshTableSafeEncode(const char *s, size_t *width)
|
|||||||
|
|
||||||
memset(&st, 0, sizeof(st));
|
memset(&st, 0, sizeof(st));
|
||||||
|
|
||||||
if (!sz)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (VIR_ALLOC_N(buf, (sz * HEX_ENCODE_LENGTH) + 1) < 0)
|
if (VIR_ALLOC_N(buf, (sz * HEX_ENCODE_LENGTH) + 1) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user