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

[libvirt] [PATCH 21/21] conf: domain: use virXMLNamespaceRegister



Signed-off-by: Ján Tomko <jtomko redhat com>
---
 src/bhyve/bhyve_domain.c | 9 ---------
 src/conf/domain_conf.c   | 2 ++
 src/lxc/lxc_domain.c     | 8 --------
 src/qemu/qemu_domain.c   | 8 --------
 src/test/test_driver.c   | 9 ---------
 5 files changed, 2 insertions(+), 34 deletions(-)

diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c
index 631fb50db9..ea4bd54969 100644
--- a/src/bhyve/bhyve_domain.c
+++ b/src/bhyve/bhyve_domain.c
@@ -27,8 +27,6 @@
 #include "viralloc.h"
 #include "virlog.h"
 
-#include <libxml/xpathInternals.h>
-
 #define VIR_FROM_THIS VIR_FROM_BHYVE
 
 VIR_LOG_INIT("bhyve.bhyve_domain");
@@ -205,13 +203,6 @@ bhyveDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
     size_t i;
     int ret = -1;
 
-    if (xmlXPathRegisterNs(ctxt, BAD_CAST "bhyve", BAD_CAST BHYVE_NAMESPACE_HREF) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to register xml namespace '%s'"),
-                       BHYVE_NAMESPACE_HREF);
-        return -1;
-    }
-
     if (VIR_ALLOC(cmd) < 0)
         return -1;
 
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a39f5f845d..b7a342bb91 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -21344,6 +21344,8 @@ virDomainDefParseXML(xmlDocPtr xml,
     def->ns = xmlopt->ns;
 
     if (def->ns.parse) {
+        if (virXMLNamespaceRegister(ctxt, &def->ns) < 0)
+            goto error;
         if ((def->ns.parse)(ctxt, &def->namespaceData) < 0)
             goto error;
     }
diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c
index 022e3c6f6a..00362e4c7f 100644
--- a/src/lxc/lxc_domain.c
+++ b/src/lxc/lxc_domain.c
@@ -26,7 +26,6 @@
 #include "viralloc.h"
 #include "virlog.h"
 #include "virerror.h"
-#include <libxml/xpathInternals.h>
 #include "virstring.h"
 #include "virutil.h"
 #include "virfile.h"
@@ -219,13 +218,6 @@ lxcDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
     char *tmp = NULL;
     size_t i;
 
-    if (xmlXPathRegisterNs(ctxt, BAD_CAST "lxc", BAD_CAST LXC_NAMESPACE_HREF) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to register xml namespace '%s'"),
-                       LXC_NAMESPACE_HREF);
-        return -1;
-    }
-
     if (VIR_ALLOC(lxcDef) < 0)
         return -1;
 
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0b2065b52c..6d770d3c13 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -73,7 +73,6 @@
 # include <selinux/selinux.h>
 #endif
 
-#include <libxml/xpathInternals.h>
 #include "dosname.h"
 
 #define QEMU_QXL_VGAMEM_DEFAULT 16 * 1024
@@ -3632,13 +3631,6 @@ qemuDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
     qemuDomainXmlNsDefPtr nsdata = NULL;
     int ret = -1;
 
-    if (xmlXPathRegisterNs(ctxt, BAD_CAST "qemu", BAD_CAST QEMU_NAMESPACE_HREF) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to register xml namespace '%s'"),
-                       QEMU_NAMESPACE_HREF);
-        return -1;
-    }
-
     if (VIR_ALLOC(nsdata) < 0)
         return -1;
 
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 3bdeb6c00a..57d54c05b3 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -26,7 +26,6 @@
 #include <unistd.h>
 #include <sys/stat.h>
 #include <libxml/xmlsave.h>
-#include <libxml/xpathInternals.h>
 
 
 #include "virerror.h"
@@ -213,14 +212,6 @@ testDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
     unsigned int tmpuint;
     VIR_AUTOFREE(xmlNodePtr *) nodes = NULL;
 
-    if (xmlXPathRegisterNs(ctxt, BAD_CAST "test",
-                           BAD_CAST TEST_NAMESPACE_HREF) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to register xml namespace '%s'"),
-                       TEST_NAMESPACE_HREF);
-        return -1;
-    }
-
     if (VIR_ALLOC(nsdata) < 0)
         return -1;
 
-- 
2.19.2


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