Export the freeing function rather than having a wrapper for the hash
creation function.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/domain_nwfilter.c | 2 +-
src/conf/nwfilter_ipaddrmap.c | 2 +-
src/conf/nwfilter_params.c | 12 +++---------
src/conf/nwfilter_params.h | 2 +-
src/conf/virnwfilterbindingdef.c | 2 +-
src/libvirt_private.syms | 2 +-
src/nwfilter/nwfilter_gentech_driver.c | 6 +++---
tests/nwfilterxml2firewalltest.c | 6 +++---
8 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/src/conf/domain_nwfilter.c b/src/conf/domain_nwfilter.c
index ef388d5d02..f32122b8a3 100644
--- a/src/conf/domain_nwfilter.c
+++ b/src/conf/domain_nwfilter.c
@@ -59,7 +59,7 @@ virNWFilterBindingDefForNet(const char *vmname,
ret->filter = g_strdup(net->filter);
- if (!(ret->filterparams = virNWFilterHashTableCreate(0)))
+ if (!(ret->filterparams = virHashNew(virNWFilterVarValueHashFree)))
goto error;
if (net->filterparams &&
diff --git a/src/conf/nwfilter_ipaddrmap.c b/src/conf/nwfilter_ipaddrmap.c
index 672a58be3a..487e7f22bd 100644
--- a/src/conf/nwfilter_ipaddrmap.c
+++ b/src/conf/nwfilter_ipaddrmap.c
@@ -149,7 +149,7 @@ virNWFilterIPAddrMapGetIPAddr(const char *ifname)
int
virNWFilterIPAddrMapInit(void)
{
- ipAddressMap = virNWFilterHashTableCreate(0);
+ ipAddressMap = virHashNew(virNWFilterVarValueHashFree);
if (!ipAddressMap)
return -1;
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index 1210079954..fd05b45ca3 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -606,19 +606,13 @@ virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci,
return res;
}
-static void
-hashDataFree(void *payload)
+void
+virNWFilterVarValueHashFree(void *payload)
{
virNWFilterVarValueFree(payload);
}
-virHashTablePtr
-virNWFilterHashTableCreate(int n)
-{
- return virHashCreate(n, hashDataFree);
-}
-
struct addToTableStruct {
virHashTablePtr target;
int errOccurred;
@@ -708,7 +702,7 @@ virNWFilterParseParamAttributes(xmlNodePtr cur)
char *nam, *val;
virNWFilterVarValuePtr value;
- virHashTablePtr table = virNWFilterHashTableCreate(0);
+ virHashTablePtr table = virHashNew(virNWFilterVarValueHashFree);
if (!table)
return NULL;
diff --git a/src/conf/nwfilter_params.h b/src/conf/nwfilter_params.h
index d51f3f7f9f..4962a86864 100644
--- a/src/conf/nwfilter_params.h
+++ b/src/conf/nwfilter_params.h
@@ -52,6 +52,7 @@ virNWFilterVarValuePtr virNWFilterVarValueCreateSimple(char *);
virNWFilterVarValuePtr virNWFilterVarValueCreateSimpleCopyValue(const char *);
virNWFilterVarValuePtr virNWFilterVarValueCopy(const virNWFilterVarValue *);
void virNWFilterVarValueFree(virNWFilterVarValuePtr val);
+void virNWFilterVarValueHashFree(void *payload);
const char *virNWFilterVarValueGetSimple(const virNWFilterVarValue *val);
const char *virNWFilterVarValueGetNthValue(const virNWFilterVarValue *val,
unsigned int idx);
@@ -67,7 +68,6 @@ int virNWFilterFormatParamAttributes(virBufferPtr buf,
virHashTablePtr table,
const char *filterref);
-virHashTablePtr virNWFilterHashTableCreate(int n);
int virNWFilterHashTablePutAll(virHashTablePtr src,
virHashTablePtr dest);
bool virNWFilterHashTableEqual(virHashTablePtr a,
diff --git a/src/conf/virnwfilterbindingdef.c b/src/conf/virnwfilterbindingdef.c
index 81f8e72182..28c1c3938c 100644
--- a/src/conf/virnwfilterbindingdef.c
+++ b/src/conf/virnwfilterbindingdef.c
@@ -65,7 +65,7 @@ virNWFilterBindingDefCopy(virNWFilterBindingDefPtr src)
ret->filter = g_strdup(src->filter);
- if (!(ret->filterparams = virNWFilterHashTableCreate(0)))
+ if (!(ret->filterparams = virHashNew(virNWFilterVarValueHashFree)))
goto error;
if (virNWFilterHashTablePutAll(src->filterparams, ret->filterparams) < 0)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 79c8403208..4f9e7f6048 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -927,7 +927,6 @@ virNWFilterIPAddrMapShutdown;
# conf/nwfilter_params.h
-virNWFilterHashTableCreate;
virNWFilterHashTableEqual;
virNWFilterHashTablePutAll;
virNWFilterVarAccessGetVarName;
@@ -948,6 +947,7 @@ virNWFilterVarValueFree;
virNWFilterVarValueGetCardinality;
virNWFilterVarValueGetNthValue;
virNWFilterVarValueGetSimple;
+virNWFilterVarValueHashFree;
# conf/object_event.h
diff --git a/src/nwfilter/nwfilter_gentech_driver.c
b/src/nwfilter/nwfilter_gentech_driver.c
index c93f2ed18f..99d2c0fce4 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -199,7 +199,7 @@ static virHashTablePtr
virNWFilterCreateVarsFrom(virHashTablePtr vars1,
virHashTablePtr vars2)
{
- virHashTablePtr res = virNWFilterHashTableCreate(0);
+ virHashTablePtr res = virHashNew(virNWFilterVarValueHashFree);
if (!res)
return NULL;
@@ -268,7 +268,7 @@ virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
ruleinst->chainPriority = def->chainPriority;
ruleinst->def = rule;
ruleinst->priority = rule->priority;
- if (!(ruleinst->vars = virNWFilterHashTableCreate(0)))
+ if (!(ruleinst->vars = virHashNew(virNWFilterVarValueHashFree)))
goto cleanup;
if (virNWFilterHashTablePutAll(vars, ruleinst->vars) < 0)
goto cleanup;
@@ -516,7 +516,7 @@ virNWFilterDoInstantiate(virNWFilterTechDriverPtr techdriver,
const char *learning;
bool reportIP = false;
- virHashTablePtr missing_vars = virNWFilterHashTableCreate(0);
+ virHashTablePtr missing_vars = virHashNew(virNWFilterVarValueHashFree);
memset(&inst, 0, sizeof(inst));
diff --git a/tests/nwfilterxml2firewalltest.c b/tests/nwfilterxml2firewalltest.c
index 755732487a..30f3dab97e 100644
--- a/tests/nwfilterxml2firewalltest.c
+++ b/tests/nwfilterxml2firewalltest.c
@@ -149,7 +149,7 @@ static virHashTablePtr
virNWFilterCreateVarsFrom(virHashTablePtr vars1,
virHashTablePtr vars2)
{
- virHashTablePtr res = virNWFilterHashTableCreate(0);
+ virHashTablePtr res = virHashNew(virNWFilterVarValueHashFree);
if (!res)
return NULL;
@@ -215,7 +215,7 @@ virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
ruleinst->chainPriority = def->chainPriority;
ruleinst->def = rule;
ruleinst->priority = rule->priority;
- if (!(ruleinst->vars = virNWFilterHashTableCreate(0)))
+ if (!(ruleinst->vars = virHashNew(virNWFilterVarValueHashFree)))
goto cleanup;
if (virNWFilterHashTablePutAll(vars, ruleinst->vars) < 0)
goto cleanup;
@@ -368,7 +368,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
{
char *actualargv = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- virHashTablePtr vars = virNWFilterHashTableCreate(0);
+ virHashTablePtr vars = virHashNew(virNWFilterVarValueHashFree);
virNWFilterInst inst;
int ret = -1;
--
2.26.2