conf: networkport: Remove virNetworkPortDefParseNode

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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-09-22 16:04:10 +02:00
parent 1cd64b7326
commit 0589afb96b
3 changed files with 5 additions and 32 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -1327,7 +1327,6 @@ virNetworkPortDefFormat;
virNetworkPortDefFormatBuf;
virNetworkPortDefFree;
virNetworkPortDefParseFile;
virNetworkPortDefParseNode;
virNetworkPortDefParseString;
virNetworkPortDefSaveStatus;