util: hash: Remove virHashValueFree

Use 'g_free' directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Peter Krempa 2020-10-21 12:08:22 +02:00
parent b82dfe3ba7
commit 8824fc8474
13 changed files with 15 additions and 26 deletions

View File

@ -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 */

View File

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

View File

@ -2213,7 +2213,6 @@ virHashSearch;
virHashSize;
virHashSteal;
virHashUpdateEntry;
virHashValueFree;
# util/virhashcode.h

View File

@ -781,7 +781,7 @@ virNWFilterLearnInit(void)
if (!pendingLearnReq)
return -1;
ifaceLockMap = virHashNew(virHashValueFree);
ifaceLockMap = virHashNew(g_free);
if (!ifaceLockMap) {
virNWFilterLearnShutdown();
return -1;

View File

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

View File

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

View File

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

View File

@ -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++) {

View File

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

View File

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

View File

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

View File

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

View File

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