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;
|
g_autoptr(GHashTable) ret = NULL;
|
||||||
|
|
||||||
ret = virHashNew((virHashDataFree) qemuMonitorJSONBlockNamedNodeDataFree);
|
ret = virHashNew((GDestroyNotify) qemuMonitorJSONBlockNamedNodeDataFree);
|
||||||
|
|
||||||
if (virJSONValueArrayForeachSteal(nodes,
|
if (virJSONValueArrayForeachSteal(nodes,
|
||||||
qemuMonitorJSONBlockGetNamedNodeDataWorker,
|
qemuMonitorJSONBlockGetNamedNodeDataWorker,
|
||||||
|
@ -83,7 +83,7 @@ virHashTableStringKey(const void *vkey)
|
|||||||
* Returns the newly created object.
|
* Returns the newly created object.
|
||||||
*/
|
*/
|
||||||
GHashTable *
|
GHashTable *
|
||||||
virHashNew(virHashDataFree dataFree)
|
virHashNew(GDestroyNotify dataFree)
|
||||||
{
|
{
|
||||||
ignore_value(virHashTableSeedInitialize());
|
ignore_value(virHashTableSeedInitialize());
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ virHashNew(virHashDataFree dataFree)
|
|||||||
|
|
||||||
|
|
||||||
virHashAtomic *
|
virHashAtomic *
|
||||||
virHashAtomicNew(virHashDataFree dataFree)
|
virHashAtomicNew(GDestroyNotify dataFree)
|
||||||
{
|
{
|
||||||
virHashAtomic *hash;
|
virHashAtomic *hash;
|
||||||
|
|
||||||
|
@ -15,14 +15,6 @@ typedef struct _virHashAtomic virHashAtomic;
|
|||||||
* function types:
|
* function types:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* virHashDataFree:
|
|
||||||
* @payload: the data in the hash
|
|
||||||
*
|
|
||||||
* Callback to free data from a hash.
|
|
||||||
*/
|
|
||||||
typedef void (*virHashDataFree) (void *payload);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virHashIterator:
|
* virHashIterator:
|
||||||
* @payload: the data in the hash
|
* @payload: the data in the hash
|
||||||
@ -50,8 +42,8 @@ typedef int (*virHashSearcher) (const void *payload, const char *name,
|
|||||||
/*
|
/*
|
||||||
* Constructor and destructor.
|
* Constructor and destructor.
|
||||||
*/
|
*/
|
||||||
GHashTable *virHashNew(virHashDataFree dataFree) G_GNUC_WARN_UNUSED_RESULT;
|
GHashTable *virHashNew(GDestroyNotify dataFree) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
virHashAtomic *virHashAtomicNew(virHashDataFree dataFree);
|
virHashAtomic *virHashAtomicNew(GDestroyNotify dataFree);
|
||||||
ssize_t virHashSize(GHashTable *table);
|
ssize_t virHashSize(GHashTable *table);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -604,8 +604,8 @@ void virObjectFreeCallback(void *opaque)
|
|||||||
* @name: ignored, name of the hash key being deleted
|
* @name: ignored, name of the hash key being deleted
|
||||||
*
|
*
|
||||||
* Provides identical functionality to virObjectUnref,
|
* Provides identical functionality to virObjectUnref,
|
||||||
* but with the signature matching the virHashDataFree
|
* but with the signature matching the GDestroyNotify
|
||||||
* typedef.
|
* typedef used with hash tables.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
virObjectFreeHashData(void *opaque)
|
virObjectFreeHashData(void *opaque)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user