[libvirt PATCH 2/6] qemu: refactor virQEMUCapsLoadFile

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

 



Use g_auto and remove pointless labels.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/qemu/qemu_capabilities.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 174352a5a2..a80c172d71 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5510,7 +5510,7 @@ virQEMUCapsLoadFile(const char *filename,
                     void *privData,
                     bool *outdated)
 {
-    virQEMUCaps *qemuCaps = virQEMUCapsNewBinary(binary);
+    g_autoptr(virQEMUCaps) qemuCaps = virQEMUCapsNewBinary(binary);
     virQEMUCapsCachePriv *priv = privData;
     int ret;
 
@@ -5519,17 +5519,13 @@ virQEMUCapsLoadFile(const char *filename,
 
     ret = virQEMUCapsLoadCache(priv->hostArch, qemuCaps, filename, false);
     if (ret < 0)
-        goto error;
+        return NULL;
     if (ret == 1) {
         *outdated = true;
-        goto error;
+        return NULL;
     }
 
-    return qemuCaps;
-
- error:
-    virObjectUnref(qemuCaps);
-    return NULL;
+    return g_steal_pointer(&qemuCaps);
 }
 
 
-- 
2.31.1




[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