virJSONValueNewArray: Use g_new0 to allocate and remove NULL checks from callers

Use the glib allocation function that never returns NULL and remove the
now dead-code checks from all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa
2020-01-31 08:18:36 +01:00
parent 3b60a0c027
commit d69470a18a
19 changed files with 35 additions and 76 deletions

View File

@@ -737,8 +737,7 @@ testQemuCheckpointDeleteMerge(const void *opaque)
return -1;
}
if (!(actions = virJSONValueNewArray()))
return -1;
actions = virJSONValueNewArray();
if (qemuCheckpointDiscardDiskBitmaps(data->chain,
nodedata,

View File

@@ -2948,9 +2948,8 @@ testQemuMonitorJSONTransaction(const void *opaque)
if (!(test = qemuMonitorTestNewSchema(data->xmlopt, data->schema)))
return -1;
if (!(actions = virJSONValueNewArray()) ||
!(mergebitmaps = virJSONValueNewArray()))
return -1;
actions = virJSONValueNewArray();
mergebitmaps = virJSONValueNewArray();
if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(mergebitmaps, "node1", "bitmap1") < 0 ||
qemuMonitorTransactionBitmapMergeSourceAddBitmap(mergebitmaps, "node2", "bitmap2") < 0)