qemu: agent: simplify access to ifaces_ret

We have a local 'iface' variable that contains the same value
eventually. Initialize it early instead of indexing two more
times.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Ján Tomko 2020-10-05 22:22:00 +02:00
parent 40b4f68d2d
commit aa61f7f9c9

View File

@ -2176,15 +2176,13 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
if (VIR_EXPAND_N(ifaces_ret, ifaces_count, 1) < 0)
goto error;
ifaces_ret[ifaces_count - 1] = g_new0(virDomainInterface, 1);
iface = g_new0(virDomainInterface, 1);
ifaces_ret[ifaces_count - 1] = iface;
if (virHashAddEntry(ifaces_store, ifname_s,
ifaces_ret[ifaces_count - 1]) < 0)
if (virHashAddEntry(ifaces_store, ifname_s, iface) < 0)
goto error;
iface = ifaces_ret[ifaces_count - 1];
iface->naddrs = 0;
iface->name = g_strdup(ifname_s);
hwaddr = virJSONValueObjectGetString(tmp_iface, "hardware-address");