[libvirt] [libvirt PATCH v6 14/15] xen_common: Change xenParseVfbs to using virConfGetValueStringList

Fabiano Fidêncio fidencio at redhat.com
Tue Sep 18 18:48:17 UTC 2018


Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 src/xenconfig/xen_common.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 9ad081e56b..a6e77a9250 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -605,8 +605,10 @@ xenParseCPUFeatures(virConfPtr conf,
 static int
 xenParseVfb(virConfPtr conf, virDomainDefPtr def)
 {
+    int ret = -1;
     int val;
     char *listenAddr = NULL;
+    char **vfbs = NULL;
     int hvm = def->os.type == VIR_DOMAIN_OSTYPE_HVM;
     virConfValuePtr list;
     virDomainGraphicsDefPtr graphics = NULL;
@@ -664,17 +666,14 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def)
     }
 
     if (!hvm && def->graphics == NULL) { /* New PV guests use this format */
-        list = virConfGetValue(conf, "vfb");
-        if (list && list->type == VIR_CONF_LIST &&
-            list->list && list->list->type == VIR_CONF_STRING &&
-            list->list->str) {
+        if (virConfGetValueStringList(conf, "vfb", false, &vfbs) == 1) {
             char vfb[MAX_VFB];
             char *key = vfb;
 
-            if (virStrcpyStatic(vfb, list->list->str) < 0) {
+            if (virStrcpyStatic(vfb, *vfbs) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("VFB %s too big for destination"),
-                               list->list->str);
+                               *vfbs);
                 goto cleanup;
             }
 
@@ -747,12 +746,13 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def)
         }
     }
 
-    return 0;
+    ret = 0;
 
  cleanup:
     virDomainGraphicsDefFree(graphics);
     VIR_FREE(listenAddr);
-    return -1;
+    virStringListFree(vfbs);
+    return ret;
 }
 
 
-- 
2.17.1




More information about the libvir-list mailing list