Use 'g_free' directly.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/domain_addr.c | 2 +-
src/hypervisor/virclosecallbacks.c | 2 +-
src/libvirt_private.syms | 1 -
src/nwfilter/nwfilter_learnipaddr.c | 2 +-
src/qemu/qemu_interop_config.c | 2 +-
src/qemu/qemu_migration_cookie.c | 2 +-
src/qemu/qemu_monitor.c | 6 +++---
src/qemu/qemu_monitor_json.c | 2 +-
src/util/virhash.c | 7 -------
src/util/virhash.h | 3 ---
tests/qemumonitorjsontest.c | 6 +++---
tests/qemusecuritymock.c | 4 ++--
tests/testutilsqemu.c | 2 +-
13 files changed, 15 insertions(+), 26 deletions(-)
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index de344186ec..37dad20ade 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -1389,7 +1389,7 @@ virDomainCCWAddressSetCreate(void)
addrs = g_new0(virDomainCCWAddressSet, 1);
- if (!(addrs->defined = virHashNew(virHashValueFree)))
+ if (!(addrs->defined = virHashNew(g_free)))
goto error;
/* must use cssid = 0xfe (254) for virtio-ccw devices */
diff --git a/src/hypervisor/virclosecallbacks.c b/src/hypervisor/virclosecallbacks.c
index 176dd5c263..a73ab818da 100644
--- a/src/hypervisor/virclosecallbacks.c
+++ b/src/hypervisor/virclosecallbacks.c
@@ -69,7 +69,7 @@ virCloseCallbacksNew(void)
if (!(closeCallbacks = virObjectLockableNew(virCloseCallbacksClass)))
return NULL;
- closeCallbacks->list = virHashNew(virHashValueFree);
+ closeCallbacks->list = virHashNew(g_free);
if (!closeCallbacks->list) {
virObjectUnref(closeCallbacks);
return NULL;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 36e2c66d93..926e982e0b 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2213,7 +2213,6 @@ virHashSearch;
virHashSize;
virHashSteal;
virHashUpdateEntry;
-virHashValueFree;
# util/virhashcode.h
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 82797d9a64..6dc535a4fe 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -781,7 +781,7 @@ virNWFilterLearnInit(void)
if (!pendingLearnReq)
return -1;
- ifaceLockMap = virHashNew(virHashValueFree);
+ ifaceLockMap = virHashNew(g_free);
if (!ifaceLockMap) {
virNWFilterLearnShutdown();
return -1;
diff --git a/src/qemu/qemu_interop_config.c b/src/qemu/qemu_interop_config.c
index 080674ce2d..53b251f056 100644
--- a/src/qemu/qemu_interop_config.c
+++ b/src/qemu/qemu_interop_config.c
@@ -125,7 +125,7 @@ qemuInteropFetchConfigs(const char *name,
homeConfig = g_strdup_printf("%s/qemu/%s", xdgConfig, name);
}
- if (!(files = virHashNew(virHashValueFree)))
+ if (!(files = virHashNew(g_free)))
return -1;
if (qemuBuildFileList(files, sysLocation) < 0)
diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
index abe797759d..708c2cced7 100644
--- a/src/qemu/qemu_migration_cookie.c
+++ b/src/qemu/qemu_migration_cookie.c
@@ -435,7 +435,7 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- g_autoptr(virHashTable) stats = virHashNew(virHashValueFree);
+ g_autoptr(virHashTable) stats = virHashNew(g_free);
bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
size_t i;
int rc;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 51de72b5bf..69d81b20c2 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2137,7 +2137,7 @@ qemuMonitorGetAllBlockStatsInfo(qemuMonitorPtr mon,
QEMU_CHECK_MONITOR(mon);
- if (!(*ret_stats = virHashNew(virHashValueFree)))
+ if (!(*ret_stats = virHashNew(g_free)))
goto error;
ret = qemuMonitorJSONGetAllBlockStatsInfo(mon, *ret_stats,
@@ -4289,7 +4289,7 @@ qemuMonitorGetMemoryDeviceInfo(qemuMonitorPtr mon,
QEMU_CHECK_MONITOR(mon);
- if (!(*info = virHashNew(virHashValueFree)))
+ if (!(*info = virHashNew(g_free)))
return -1;
if ((ret = qemuMonitorJSONGetMemoryDeviceInfo(mon, *info)) < 0) {
@@ -4593,7 +4593,7 @@ qemuMonitorGetPRManagerInfo(qemuMonitorPtr mon,
QEMU_CHECK_MONITOR(mon);
- if (!(info = virHashNew(virHashValueFree)))
+ if (!(info = virHashNew(g_free)))
goto cleanup;
if (qemuMonitorJSONGetPRManagerInfo(mon, info) < 0)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 91cc0c9046..2689ad50b9 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -5126,7 +5126,7 @@ qemuMonitorJSONGetAllBlockJobInfo(qemuMonitorPtr mon,
}
nr_results = virJSONValueArraySize(data);
- if (!(blockJobs = virHashNew(virHashValueFree)))
+ if (!(blockJobs = virHashNew(g_free)))
goto cleanup;
for (i = 0; i < nr_results; i++) {
diff --git a/src/util/virhash.c b/src/util/virhash.c
index ce09f8f248..c781e1d5a5 100644
--- a/src/util/virhash.c
+++ b/src/util/virhash.c
@@ -111,13 +111,6 @@ static void virHashStrFree(void *name)
}
-void
-virHashValueFree(void *value)
-{
- VIR_FREE(value);
-}
-
-
static size_t
virHashComputeKey(const virHashTable *table, const void *name)
{
diff --git a/src/util/virhash.h b/src/util/virhash.h
index b136455f1f..2d221dce25 100644
--- a/src/util/virhash.h
+++ b/src/util/virhash.h
@@ -202,7 +202,4 @@ ssize_t virHashRemoveSet(virHashTablePtr table, virHashSearcher iter,
const void
void *virHashSearch(const virHashTable *table, virHashSearcher iter,
const void *data, void **name);
-/* Convenience for when VIR_FREE(value) is sufficient as a data freer. */
-void virHashValueFree(void *value);
-
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virHashTable, virHashFree);
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index f50ecdeb3f..da7fd4625a 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1649,8 +1649,8 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const void *opaque)
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
return -1;
- if (!(blockDevices = virHashNew(virHashValueFree)) ||
- !(expectedBlockDevices = virHashNew(virHashValueFree)))
+ if (!(blockDevices = virHashNew(g_free)) ||
+ !(expectedBlockDevices = virHashNew(g_free)))
goto cleanup;
info = g_new0(struct qemuDomainDiskInfo, 1);
@@ -1811,7 +1811,7 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo(const void
*opaque)
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
return -1;
- if (!(blockstats = virHashNew(virHashValueFree)))
+ if (!(blockstats = virHashNew(g_free)))
goto cleanup;
if (qemuMonitorTestAddItem(test, "query-blockstats", reply) < 0)
diff --git a/tests/qemusecuritymock.c b/tests/qemusecuritymock.c
index c1344b3daa..839be55665 100644
--- a/tests/qemusecuritymock.c
+++ b/tests/qemusecuritymock.c
@@ -85,12 +85,12 @@ init_hash(void)
if (xattr_paths)
return;
- if (!(xattr_paths = virHashNew(virHashValueFree))) {
+ if (!(xattr_paths = virHashNew(g_free))) {
fprintf(stderr, "Unable to create hash table for XATTR paths\n");
abort();
}
- if (!(chown_paths = virHashNew(virHashValueFree))) {
+ if (!(chown_paths = virHashNew(g_free))) {
fprintf(stderr, "Unable to create hash table for chowned paths\n");
abort();
}
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 3f50d46d87..4defba0b7b 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -576,7 +576,7 @@ testQemuGetLatestCaps(void)
virHashTablePtr capslatest;
size_t i;
- if (!(capslatest = virHashNew(virHashValueFree)))
+ if (!(capslatest = virHashNew(g_free)))
goto error;
VIR_TEST_VERBOSE("");
--
2.26.2