[libvirt PATCH 08/14] qemu: agent: simplify access to ifaces_ret

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/qemu/qemu_agent.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index d0319cc0c7..7a4f5cd6db 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -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");
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux