[PATCH 03/12] cpu_ppc64.c: modernize ppc64VendorParse()

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

 



Use g_autoptr() in virCPUppc64VendorPtr and remove the now
uneeded 'cleanup' label.

Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 src/cpu/cpu_ppc64.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index b003e48bed..6c73145f06 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -279,8 +279,7 @@ ppc64VendorParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED,
                  void *data)
 {
     struct ppc64_map *map = data;
-    virCPUppc64VendorPtr vendor;
-    int ret = -1;
+    g_autoptr(virCPUppc64Vendor) vendor = NULL;
 
     if (VIR_ALLOC(vendor) < 0)
         return -1;
@@ -290,17 +289,13 @@ ppc64VendorParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED,
     if (ppc64VendorFind(map, vendor->name)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("CPU vendor %s already defined"), vendor->name);
-        goto cleanup;
+        return -1;
     }
 
     if (VIR_APPEND_ELEMENT(map->vendors, map->nvendors, vendor) < 0)
-        goto cleanup;
-
-    ret = 0;
+        return -1;
 
- cleanup:
-    ppc64VendorFree(vendor);
-    return ret;
+    return 0;
 }
 
 
-- 
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