Replace virNWFilterDefParseString/File with the common function.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/nwfilter_conf.c | 17 +----------------
src/conf/nwfilter_conf.h | 8 +++-----
src/conf/virnwfilterobj.c | 2 +-
src/libvirt_private.syms | 3 +--
src/nwfilter/nwfilter_driver.c | 2 +-
tests/nwfilterxml2firewalltest.c | 2 +-
tests/nwfilterxml2xmltest.c | 2 +-
7 files changed, 9 insertions(+), 27 deletions(-)
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 00728782d1..9a95ae6c12 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -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)
diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h
index b8a970f00b..1a38e4198c 100644
--- a/src/conf/nwfilter_conf.h
+++ b/src/conf/nwfilter_conf.h
@@ -541,11 +541,9 @@ virNWFilterSaveConfig(const char *configDir,
virNWFilterDef *def);
virNWFilterDef *
-virNWFilterDefParseString(const char *xml,
- unsigned int flags);
-
-virNWFilterDef *
-virNWFilterDefParseFile(const char *filename);
+virNWFilterDefParse(const char *xmlStr,
+ const char *filename,
+ unsigned int flags);
typedef int (*virNWFilterTriggerRebuildCallback)(void *opaque);
diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c
index f9c1b049d5..e8dfe66b3c 100644
--- a/src/conf/virnwfilterobj.c
+++ b/src/conf/virnwfilterobj.c
@@ -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)) {
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 0adcf20f0c..6836c99fff 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -952,8 +952,7 @@ virNWFilterConfLayerInit;
virNWFilterConfLayerShutdown;
virNWFilterDefFormat;
virNWFilterDefFree;
-virNWFilterDefParseFile;
-virNWFilterDefParseString;
+virNWFilterDefParse;
virNWFilterDeleteDef;
virNWFilterJumpTargetTypeToString;
virNWFilterPrintStateMatchFlags;
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index f9fc09bbd3..8e45096eaa 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -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)
diff --git a/tests/nwfilterxml2firewalltest.c b/tests/nwfilterxml2firewalltest.c
index 1514002b8f..bd112cef83 100644
--- a/tests/nwfilterxml2firewalltest.c
+++ b/tests/nwfilterxml2firewalltest.c
@@ -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;
diff --git a/tests/nwfilterxml2xmltest.c b/tests/nwfilterxml2xmltest.c
index c2b6dc575b..ca037ad9a0 100644
--- a/tests/nwfilterxml2xmltest.c
+++ b/tests/nwfilterxml2xmltest.c
@@ -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;
--
2.37.3