[PATCH 09/10] conf: node_device: cleanup virNodeDevCapCCWParseXML

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

 



Make use of g_autofree

Signed-off-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx>
Reviewed-by: Bjoern Walk <bwalk@xxxxxxxxxxxxx>
---
 src/conf/node_device_conf.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index ebabf20b67..39950565b5 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -839,57 +839,52 @@ virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt,
                          virNodeDevCapCCWPtr ccw_dev)
 {
     VIR_XPATH_NODE_AUTORESTORE(ctxt)
-    int ret = -1;
-    char *cssid = NULL, *ssid = NULL, *devno = NULL;
+    g_autofree char *cssid = NULL;
+    g_autofree char *ssid = NULL;
+    g_autofree char *devno = NULL;
 
     ctxt->node = node;
 
-   if (!(cssid = virXPathString("string(./cssid[1])", ctxt))) {
+    if (!(cssid = virXPathString("string(./cssid[1])", ctxt))) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("missing cssid value for '%s'"), def->name);
-        goto out;
+        return -1;
     }
 
     if (virStrToLong_uip(cssid, NULL, 0, &ccw_dev->cssid) < 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("invalid cssid value '%s' for '%s'"),
                        cssid, def->name);
-        goto out;
+        return -1;
     }
 
     if (!(ssid = virXPathString("string(./ssid[1])", ctxt))) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("missing ssid value for '%s'"), def->name);
-        goto out;
+        return -1;
     }
 
     if (virStrToLong_uip(ssid, NULL, 0, &ccw_dev->ssid) < 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("invalid ssid value '%s' for '%s'"),
                        cssid, def->name);
-        goto out;
+        return -1;
     }
 
     if (!(devno = virXPathString("string(./devno[1])", ctxt))) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("missing devno value for '%s'"), def->name);
-        goto out;
+        return -1;
     }
 
     if (virStrToLong_uip(devno, NULL, 16, &ccw_dev->devno) < 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("invalid devno value '%s' for '%s'"),
                        devno, def->name);
-        goto out;
+        return -1;
     }
 
-    ret = 0;
-
- out:
-    VIR_FREE(cssid);
-    VIR_FREE(ssid);
-    VIR_FREE(devno);
-    return ret;
+    return 0;
 }
 
 
-- 
2.25.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