mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 01:34:11 +03:00
Replace open coded virJSONValueArrayAppendString
In two instances we've created a string virJSONValue just to append it to the array. Replace it by use of the virJSONValueArrayAppendString helper. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
This commit is contained in:
parent
b58f88a919
commit
f668e17bea
@ -1168,9 +1168,7 @@ qemuAgentMakeStringsArray(const char **strings, unsigned int len)
|
||||
g_autoptr(virJSONValue) ret = virJSONValueNewArray();
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
g_autoptr(virJSONValue) str = virJSONValueNewString(strings[i]);
|
||||
|
||||
if (virJSONValueArrayAppend(ret, &str) < 0)
|
||||
if (virJSONValueArrayAppendString(ret, strings[i]) < 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -214,9 +214,7 @@ virMACMapHashDumper(void *payload,
|
||||
GSList *next;
|
||||
|
||||
for (next = macs; next; next = next->next) {
|
||||
g_autoptr(virJSONValue) m = virJSONValueNewString((const char *) next->data);
|
||||
|
||||
if (virJSONValueArrayAppend(arr, &m) < 0)
|
||||
if (virJSONValueArrayAppendString(arr, (const char *) next->data) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user