]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: ns.parse: decouple call from condition
authorJán Tomko <jtomko@redhat.com>
Tue, 20 Aug 2019 20:12:55 +0000 (22:12 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 21 Aug 2019 08:29:19 +0000 (10:29 +0200)
In the future we will perform more actions if ns.parse
is present. Decouple the condition from the actual call.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/conf/domain_conf.c
src/conf/network_conf.c
src/conf/storage_conf.c

index 1f2a91c7108b925ebc75dccfc0dba8ae005b2382..0d786f53d770346daad65327e2f15b52fcfcec0e 100644 (file)
@@ -21343,9 +21343,10 @@ virDomainDefParseXML(xmlDocPtr xml,
      */
     def->ns = xmlopt->ns;
 
-    if (def->ns.parse &&
-        (def->ns.parse)(ctxt, &def->namespaceData) < 0)
-        goto error;
+    if (def->ns.parse) {
+        if ((def->ns.parse)(ctxt, &def->namespaceData) < 0)
+            goto error;
+    }
 
     return def;
 
index c5a243684aadb1cc9da133e34061ba3e68228d01..f55b9e5409368b3a055829de6a1db22f09082ba9 100644 (file)
@@ -2050,9 +2050,10 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt,
 
     if (xmlopt)
         def->ns = xmlopt->ns;
-    if (def->ns.parse &&
-        (def->ns.parse)(ctxt, &def->namespaceData) < 0)
-        goto error;
+    if (def->ns.parse) {
+        if ((def->ns.parse)(ctxt, &def->namespaceData) < 0)
+            goto error;
+    }
 
     ctxt->node = save;
     return def;
index 05055cdc2984379f751be048135fc7b5fa6d33e5..a2b977989f34491c5063e5f2fc8acc55db0a1609 100644 (file)
@@ -997,9 +997,10 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
     /* Make a copy of all the callback pointers here for easier use,
      * especially during the virStoragePoolSourceClear method */
     def->ns = options->ns;
-    if (def->ns.parse &&
-        (def->ns.parse)(ctxt, &def->namespaceData) < 0)
-        return NULL;
+    if (def->ns.parse) {
+        if ((def->ns.parse)(ctxt, &def->namespaceData) < 0)
+            return NULL;
+    }
 
     VIR_STEAL_PTR(ret, def);
     return ret;