[PATCH] conf: fix inverted parameters in hash iterator callbacks

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

 



virHashTableForEach unhelpfully has payload/key args in
its callback reversed compared to g_hash_table_foreach.
When converting from one to the other the semantics
change but you don't get a compile error

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---

This fixes the virNWFilterObjList conversion to GHashTable
which I clearly forgot to re-test properly after replacing
virHashTableForEach with g_hash_table_foreach in my
patch.

src/conf/virnwfilterobj.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c
index a569a52002..309f8bddb4 100644
--- a/src/conf/virnwfilterobj.c
+++ b/src/conf/virnwfilterobj.c
@@ -380,8 +380,8 @@ struct virNWFilterObjListData {
 
 
 static void
-virNWFilterObjListCount(void *payload,
-                        void *key G_GNUC_UNUSED,
+virNWFilterObjListCount(void *key G_GNUC_UNUSED,
+                        void *payload,
                         void *opaque)
 {
     virNWFilterObj *obj = payload;
@@ -417,8 +417,8 @@ struct virNWFilterNameData {
 
 
 static void
-virNWFilterObjListCopyNames(void *payload,
-                            void *key G_GNUC_UNUSED,
+virNWFilterObjListCopyNames(void *key G_GNUC_UNUSED,
+                            void *payload,
                             void *opaque)
 {
     virNWFilterObj *obj = payload;
@@ -460,15 +460,15 @@ struct virNWFilterListData {
 
 
 static void
-virNWFilterObjListCollectIterator(void *payload,
-                                  void *key G_GNUC_UNUSED,
+virNWFilterObjListCollectIterator(void *key G_GNUC_UNUSED,
+                                  void *payload,
                                   void *opaque)
 {
     struct virNWFilterListData *data = opaque;
     virNWFilterObj *obj = payload;
 
     virNWFilterObjLock(obj);
-    data->filters[data->nfilters++] = payload;
+    data->filters[data->nfilters++] = obj;
 }
 
 
-- 
2.35.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