mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
qemuBlockNodeNameGetBackingChain: Shuffle around variable initialization
Allocate the hash tables first so tat the 'data' struct can be directly initialized removing the need for a memset and two additional assignments. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
This commit is contained in:
parent
032af88d85
commit
5a661107ab
@ -230,20 +230,16 @@ GHashTable *
|
||||
qemuBlockNodeNameGetBackingChain(virJSONValue *namednodes,
|
||||
virJSONValue *blockstats)
|
||||
{
|
||||
struct qemuBlockNodeNameGetBackingChainData data;
|
||||
g_autoptr(GHashTable) namednodestable = virHashNew(virJSONValueHashFree);
|
||||
g_autoptr(GHashTable) disks = virHashNew(qemuBlockNodeNameBackingChainDataHashEntryFree);
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
struct qemuBlockNodeNameGetBackingChainData data = { .nodenamestable = namednodestable,
|
||||
.disks = disks };
|
||||
|
||||
if (virJSONValueArrayForeachSteal(namednodes,
|
||||
qemuBlockNamedNodesArrayToHash,
|
||||
namednodestable) < 0)
|
||||
return NULL;
|
||||
|
||||
data.nodenamestable = namednodestable;
|
||||
data.disks = disks;
|
||||
|
||||
if (virJSONValueArrayForeachSteal(blockstats,
|
||||
qemuBlockNodeNameGetBackingChainDisk,
|
||||
&data) < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user