]> xenbits.xensource.com Git - libvirt.git/commitdiff
xen_common: Change xenConfigCopyStringInternal to use virConfGetValueString
authorFabiano FidĂȘncio <fidencio@redhat.com>
Thu, 20 Sep 2018 13:28:47 +0000 (15:28 +0200)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 20 Sep 2018 20:39:01 +0000 (16:39 -0400)
Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/xenconfig/xen_common.c

index 36a9d27c8019223c8e0ff0b18390144fcdef3d56..a35e1aff585b2468fe6f40c13633d9c790f8c011 100644 (file)
@@ -145,23 +145,13 @@ xenConfigCopyStringInternal(virConfPtr conf,
                             char **value,
                             int allowMissing)
 {
-    virConfValuePtr val;
+    int rc;
 
     *value = NULL;
-    if (!(val = virConfGetValue(conf, name))) {
-        if (allowMissing)
-            return 0;
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("config value %s was missing"), name);
+    if ((rc = virConfGetValueString(conf, name, value)) < 0)
         return -1;
-    }
 
-    if (val->type != VIR_CONF_STRING) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("config value %s was not a string"), name);
-        return -1;
-    }
-    if (!val->str) {
+    if (rc == 0) {
         if (allowMissing)
             return 0;
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -169,7 +159,7 @@ xenConfigCopyStringInternal(virConfPtr conf,
         return -1;
     }
 
-    return VIR_STRDUP(*value, val->str);
+    return 1;
 }