mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
util: virhash: Replace 'virHashDataFree' by 'GDestroyNotify'
We pass through to glib's hash table functions so we can also use glibs function prototype definition. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
19ddeaf607
commit
47ee68e8cc
@ -2830,7 +2830,7 @@ qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValue *nodes)
|
||||
{
|
||||
g_autoptr(GHashTable) ret = NULL;
|
||||
|
||||
ret = virHashNew((virHashDataFree) qemuMonitorJSONBlockNamedNodeDataFree);
|
||||
ret = virHashNew((GDestroyNotify) qemuMonitorJSONBlockNamedNodeDataFree);
|
||||
|
||||
if (virJSONValueArrayForeachSteal(nodes,
|
||||
qemuMonitorJSONBlockGetNamedNodeDataWorker,
|
||||
|
@ -83,7 +83,7 @@ virHashTableStringKey(const void *vkey)
|
||||
* Returns the newly created object.
|
||||
*/
|
||||
GHashTable *
|
||||
virHashNew(virHashDataFree dataFree)
|
||||
virHashNew(GDestroyNotify dataFree)
|
||||
{
|
||||
ignore_value(virHashTableSeedInitialize());
|
||||
|
||||
@ -92,7 +92,7 @@ virHashNew(virHashDataFree dataFree)
|
||||
|
||||
|
||||
virHashAtomic *
|
||||
virHashAtomicNew(virHashDataFree dataFree)
|
||||
virHashAtomicNew(GDestroyNotify dataFree)
|
||||
{
|
||||
virHashAtomic *hash;
|
||||
|
||||
|
@ -15,14 +15,6 @@ typedef struct _virHashAtomic virHashAtomic;
|
||||
* function types:
|
||||
*/
|
||||
|
||||
/**
|
||||
* virHashDataFree:
|
||||
* @payload: the data in the hash
|
||||
*
|
||||
* Callback to free data from a hash.
|
||||
*/
|
||||
typedef void (*virHashDataFree) (void *payload);
|
||||
|
||||
/**
|
||||
* virHashIterator:
|
||||
* @payload: the data in the hash
|
||||
@ -50,8 +42,8 @@ typedef int (*virHashSearcher) (const void *payload, const char *name,
|
||||
/*
|
||||
* Constructor and destructor.
|
||||
*/
|
||||
GHashTable *virHashNew(virHashDataFree dataFree) G_GNUC_WARN_UNUSED_RESULT;
|
||||
virHashAtomic *virHashAtomicNew(virHashDataFree dataFree);
|
||||
GHashTable *virHashNew(GDestroyNotify dataFree) G_GNUC_WARN_UNUSED_RESULT;
|
||||
virHashAtomic *virHashAtomicNew(GDestroyNotify dataFree);
|
||||
ssize_t virHashSize(GHashTable *table);
|
||||
|
||||
/*
|
||||
|
@ -604,8 +604,8 @@ void virObjectFreeCallback(void *opaque)
|
||||
* @name: ignored, name of the hash key being deleted
|
||||
*
|
||||
* Provides identical functionality to virObjectUnref,
|
||||
* but with the signature matching the virHashDataFree
|
||||
* typedef.
|
||||
* but with the signature matching the GDestroyNotify
|
||||
* typedef used with hash tables.
|
||||
*/
|
||||
void
|
||||
virObjectFreeHashData(void *opaque)
|
||||
|
Loading…
x
Reference in New Issue
Block a user