The function is exported but used only intenally, additionally everything it did for the only caller can be replaced by properly using virXMLParse. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/conf/virnetworkportdef.c | 32 +++++--------------------------- src/conf/virnetworkportdef.h | 4 ---- src/libvirt_private.syms | 1 - 3 files changed, 5 insertions(+), 32 deletions(-) diff --git a/src/conf/virnetworkportdef.c b/src/conf/virnetworkportdef.c index 40cadc4ae8..651e4c3329 100644 --- a/src/conf/virnetworkportdef.c +++ b/src/conf/virnetworkportdef.c @@ -251,42 +251,20 @@ virNetworkPortDefParseXML(xmlXPathContextPtr ctxt) } -virNetworkPortDef * -virNetworkPortDefParseNode(xmlDocPtr xml, - xmlNodePtr root) -{ - g_autoptr(xmlXPathContext) ctxt = NULL; - - if (STRNEQ((const char *)root->name, "networkport")) { - virReportError(VIR_ERR_XML_ERROR, - "%s", - _("unknown root element for network port")); - return NULL; - } - - if (!(ctxt = virXMLXPathContextNew(xml))) - return NULL; - - ctxt->node = root; - return virNetworkPortDefParseXML(ctxt); -} - - static virNetworkPortDef * virNetworkPortDefParse(const char *xmlStr, const char *filename, unsigned int flags) { - virNetworkPortDef *def = NULL; g_autoptr(xmlDoc) xml = NULL; + g_autoptr(xmlXPathContext) ctxt = NULL; bool validate = flags & VIR_NETWORK_PORT_CREATE_VALIDATE; - if ((xml = virXMLParse(filename, xmlStr, _("(networkport_definition)"), - NULL, NULL, "networkport.rng", validate))) { - def = virNetworkPortDefParseNode(xml, xmlDocGetRootElement(xml)); - } + if (!(xml = virXMLParse(filename, xmlStr, _("(networkport_definition)"), + "networkport", &ctxt, "networkport.rng", validate))) + return NULL; - return def; + return virNetworkPortDefParseXML(ctxt); } diff --git a/src/conf/virnetworkportdef.h b/src/conf/virnetworkportdef.h index c661534046..908a7c8795 100644 --- a/src/conf/virnetworkportdef.h +++ b/src/conf/virnetworkportdef.h @@ -80,10 +80,6 @@ void virNetworkPortDefFree(virNetworkPortDef *port); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetworkPortDef, virNetworkPortDefFree); -virNetworkPortDef * -virNetworkPortDefParseNode(xmlDocPtr xml, - xmlNodePtr root); - virNetworkPortDef * virNetworkPortDefParseString(const char *xml, unsigned int flags); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index b8165c07d9..903c4196df 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1327,7 +1327,6 @@ virNetworkPortDefFormat; virNetworkPortDefFormatBuf; virNetworkPortDefFree; virNetworkPortDefParseFile; -virNetworkPortDefParseNode; virNetworkPortDefParseString; virNetworkPortDefSaveStatus; -- 2.37.3