summaryrefslogtreecommitdiff
path: root/tools/vsh-table.c
diff options
context:
space:
mode:
authorPeter Krempa <pkrempa@redhat.com>2021-08-03 14:14:20 +0200
committerPeter Krempa <pkrempa@redhat.com>2021-08-06 08:53:25 +0200
commit98f6f2081d7be667bdae135f857e1e72d187a415 (patch)
tree8e9752479f3ab6b87d870d577ee35bcd058ced42 /tools/vsh-table.c
parent8c22b28dbe1b5e8062869c58be129338760daa9a (diff)
downloadlibvirt-98f6f2081d7be667bdae135f857e1e72d187a415.tar.gz
util: alloc: Reimplement VIR_APPEND_ELEMENT using virAppendElement
Use virAppendElement instead of virInsertElementsN to implement VIR_APPEND_ELEMENT which allows us to remove error handling as the only relevant errors were removed when switching to aborting memory allocation functions. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Diffstat (limited to 'tools/vsh-table.c')
-rw-r--r--tools/vsh-table.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/tools/vsh-table.c b/tools/vsh-table.c
index 78d1cb27f1..7fb0f13ee6 100644
--- a/tools/vsh-table.c
+++ b/tools/vsh-table.c
@@ -102,8 +102,7 @@ vshTableRowNew(const char *arg, va_list ap)
tmp = g_strdup(arg);
- if (VIR_APPEND_ELEMENT(row->cells, row->ncells, tmp) < 0)
- goto error;
+ VIR_APPEND_ELEMENT(row->cells, row->ncells, tmp);
arg = va_arg(ap, const char *);
}
@@ -140,8 +139,7 @@ vshTableNew(const char *arg, ...)
if (!header)
goto error;
- if (VIR_APPEND_ELEMENT(table->rows, table->nrows, header) < 0)
- goto error;
+ VIR_APPEND_ELEMENT(table->rows, table->nrows, header);
return table;
error:
@@ -182,8 +180,7 @@ vshTableRowAppend(vshTable *table, const char *arg, ...)
goto cleanup;
}
- if (VIR_APPEND_ELEMENT(table->rows, table->nrows, row) < 0)
- goto cleanup;
+ VIR_APPEND_ELEMENT(table->rows, table->nrows, row);
ret = 0;
cleanup: