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>
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;
}
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;
}