conf: domain: use virXMLNamespaceRegister

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Ján Tomko 2019-08-21 00:23:10 +02:00
parent 80fb4d9c81
commit 6f2819ef20
5 changed files with 2 additions and 34 deletions

View File

@ -27,8 +27,6 @@
#include "viralloc.h" #include "viralloc.h"
#include "virlog.h" #include "virlog.h"
#include <libxml/xpathInternals.h>
#define VIR_FROM_THIS VIR_FROM_BHYVE #define VIR_FROM_THIS VIR_FROM_BHYVE
VIR_LOG_INIT("bhyve.bhyve_domain"); VIR_LOG_INIT("bhyve.bhyve_domain");
@ -205,13 +203,6 @@ bhyveDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
size_t i; size_t i;
int ret = -1; 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) if (VIR_ALLOC(cmd) < 0)
return -1; return -1;

View File

@ -21344,6 +21344,8 @@ virDomainDefParseXML(xmlDocPtr xml,
def->ns = xmlopt->ns; def->ns = xmlopt->ns;
if (def->ns.parse) { if (def->ns.parse) {
if (virXMLNamespaceRegister(ctxt, &def->ns) < 0)
goto error;
if ((def->ns.parse)(ctxt, &def->namespaceData) < 0) if ((def->ns.parse)(ctxt, &def->namespaceData) < 0)
goto error; goto error;
} }

View File

@ -26,7 +26,6 @@
#include "viralloc.h" #include "viralloc.h"
#include "virlog.h" #include "virlog.h"
#include "virerror.h" #include "virerror.h"
#include <libxml/xpathInternals.h>
#include "virstring.h" #include "virstring.h"
#include "virutil.h" #include "virutil.h"
#include "virfile.h" #include "virfile.h"
@ -219,13 +218,6 @@ lxcDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
char *tmp = NULL; char *tmp = NULL;
size_t i; 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) if (VIR_ALLOC(lxcDef) < 0)
return -1; return -1;

View File

@ -73,7 +73,6 @@
# include <selinux/selinux.h> # include <selinux/selinux.h>
#endif #endif
#include <libxml/xpathInternals.h>
#include "dosname.h" #include "dosname.h"
#define QEMU_QXL_VGAMEM_DEFAULT 16 * 1024 #define QEMU_QXL_VGAMEM_DEFAULT 16 * 1024
@ -3632,13 +3631,6 @@ qemuDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
qemuDomainXmlNsDefPtr nsdata = NULL; qemuDomainXmlNsDefPtr nsdata = NULL;
int ret = -1; 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) if (VIR_ALLOC(nsdata) < 0)
return -1; return -1;

View File

@ -26,7 +26,6 @@
#include <unistd.h> #include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <libxml/xmlsave.h> #include <libxml/xmlsave.h>
#include <libxml/xpathInternals.h>
#include "virerror.h" #include "virerror.h"
@ -213,14 +212,6 @@ testDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
unsigned int tmpuint; unsigned int tmpuint;
VIR_AUTOFREE(xmlNodePtr *) nodes = NULL; 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) if (VIR_ALLOC(nsdata) < 0)
return -1; return -1;