[PATCH 23/23] util: virhash: Replace 'virHashDataFree' by 'GDestroyNotify'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We pass through to glib's hash table functions so we can also use glibs
function prototype definition.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_monitor_json.c |  2 +-
 src/util/virhash.c           |  4 ++--
 src/util/virhash.h           | 12 ++----------
 src/util/virobject.c         |  4 ++--
 4 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 56f0b22b2a..c10ea583fd 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2830,7 +2830,7 @@ qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValue *nodes)
 {
     g_autoptr(GHashTable) ret = NULL;

-    ret = virHashNew((virHashDataFree) qemuMonitorJSONBlockNamedNodeDataFree);
+    ret = virHashNew((GDestroyNotify) qemuMonitorJSONBlockNamedNodeDataFree);

     if (virJSONValueArrayForeachSteal(nodes,
                                       qemuMonitorJSONBlockGetNamedNodeDataWorker,
diff --git a/src/util/virhash.c b/src/util/virhash.c
index ce954e86ec..9fcef621fd 100644
--- a/src/util/virhash.c
+++ b/src/util/virhash.c
@@ -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;

diff --git a/src/util/virhash.h b/src/util/virhash.h
index fcab8454bd..8a6b8a7d37 100644
--- a/src/util/virhash.h
+++ b/src/util/virhash.h
@@ -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);

 /*
diff --git a/src/util/virobject.c b/src/util/virobject.c
index 3412985b79..588b41802c 100644
--- a/src/util/virobject.c
+++ b/src/util/virobject.c
@@ -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)
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux