conf: nwfilter: Provide only virNWFilterDefParse

Replace virNWFilterDefParseString/File with the common function.

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-23 10:36:36 +02:00
parent 2a8998d427
commit 5ea1d04322
7 changed files with 9 additions and 27 deletions

View File

@ -2685,7 +2685,7 @@ virNWFilterDefParseXML(xmlXPathContextPtr ctxt)
}
static virNWFilterDef *
virNWFilterDef *
virNWFilterDefParse(const char *xmlStr,
const char *filename,
unsigned int flags)
@ -2702,21 +2702,6 @@ virNWFilterDefParse(const char *xmlStr,
}
virNWFilterDef *
virNWFilterDefParseString(const char *xmlStr,
unsigned int flags)
{
return virNWFilterDefParse(xmlStr, NULL, flags);
}
virNWFilterDef *
virNWFilterDefParseFile(const char *filename)
{
return virNWFilterDefParse(NULL, filename, 0);
}
int
virNWFilterSaveConfig(const char *configDir,
virNWFilterDef *def)

View File

@ -541,12 +541,10 @@ virNWFilterSaveConfig(const char *configDir,
virNWFilterDef *def);
virNWFilterDef *
virNWFilterDefParseString(const char *xml,
virNWFilterDefParse(const char *xmlStr,
const char *filename,
unsigned int flags);
virNWFilterDef *
virNWFilterDefParseFile(const char *filename);
typedef int (*virNWFilterTriggerRebuildCallback)(void *opaque);
int

View File

@ -578,7 +578,7 @@ virNWFilterObjListLoadConfig(virNWFilterObjList *nwfilters,
if (!(configFile = virFileBuildPath(configDir, name, ".xml")))
goto error;
if (!(def = virNWFilterDefParseFile(configFile)))
if (!(def = virNWFilterDefParse(NULL, configFile, 0)))
goto error;
if (STRNEQ(name, def->name)) {

View File

@ -952,8 +952,7 @@ virNWFilterConfLayerInit;
virNWFilterConfLayerShutdown;
virNWFilterDefFormat;
virNWFilterDefFree;
virNWFilterDefParseFile;
virNWFilterDefParseString;
virNWFilterDefParse;
virNWFilterDeleteDef;
virNWFilterJumpTargetTypeToString;
virNWFilterPrintStateMatchFlags;

View File

@ -545,7 +545,7 @@ nwfilterDefineXMLFlags(virConnectPtr conn,
return NULL;
}
if (!(def = virNWFilterDefParseString(xml, flags)))
if (!(def = virNWFilterDefParse(xml, NULL, flags)))
goto cleanup;
if (virNWFilterDefineXMLFlagsEnsureACL(conn, def) < 0)

View File

@ -255,7 +255,7 @@ virNWFilterDefToInst(const char *xml,
{
size_t i;
int ret = -1;
virNWFilterDef *def = virNWFilterDefParseFile(xml);
virNWFilterDef *def = virNWFilterDefParse(NULL, xml, 0);
if (!def)
return -1;

View File

@ -21,7 +21,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
virResetLastError();
if (!(dev = virNWFilterDefParseFile(inxml))) {
if (!(dev = virNWFilterDefParse(NULL, inxml, 0))) {
if (expect_error) {
virResetLastError();
goto done;