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

[libvirt] [PATCH 1/5] Remove bogus const annotations to hash iterator



Most of the hash iterators need to modify either payload of
data args. The const annotation prevents this.

* src/util/hash.h, src/util/hash.c: Remove const-ness from
  virHashForEach/Iterator
* src/xen/xm_internal.c: Remove bogus casts
---
 src/util/hash.c       |    2 +-
 src/util/hash.h       |    4 ++--
 src/xen/xm_internal.c |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/util/hash.c b/src/util/hash.c
index 42a28d1..40df2c6 100644
--- a/src/util/hash.c
+++ b/src/util/hash.c
@@ -482,7 +482,7 @@ virHashRemoveEntry(virHashTablePtr table, const char *name,
  *
  * Returns number of items iterated over upon completion, -1 on failure
  */
-int virHashForEach(virHashTablePtr table, virHashIterator iter, const void *data) {
+int virHashForEach(virHashTablePtr table, virHashIterator iter, void *data) {
     int i, count = 0;
 
     if (table == NULL || iter == NULL)
diff --git a/src/util/hash.h b/src/util/hash.h
index 7778909..a163f10 100644
--- a/src/util/hash.h
+++ b/src/util/hash.h
@@ -38,7 +38,7 @@ typedef void (*virHashDeallocator) (void *payload, const char *name);
  *
  * Callback to process a hash entry during iteration
  */
-typedef void (*virHashIterator) (const void *payload, const char *name, const void *data);
+typedef void (*virHashIterator) (void *payload, const char *name, void *data);
 /**
  * virHashSearcher
  * @payload: the data in the hash
@@ -82,7 +82,7 @@ void *virHashLookup(virHashTablePtr table, const char *name);
 /*
  * Iterators
  */
-int virHashForEach(virHashTablePtr table, virHashIterator iter, const void *data);
+int virHashForEach(virHashTablePtr table, virHashIterator iter, void *data);
 int virHashRemoveSet(virHashTablePtr table, virHashSearcher iter, virHashDeallocator f, const void *data);
 void *virHashSearch(virHashTablePtr table, virHashSearcher iter, const void *data);
 
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index ebbaae8..732b2d3 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -2750,8 +2750,8 @@ struct xenXMListIteratorContext {
     char ** names;
 };
 
-static void xenXMListIterator(const void *payload ATTRIBUTE_UNUSED, const char *name, const void *data) {
-    struct xenXMListIteratorContext *ctx = (struct xenXMListIteratorContext *)data;
+static void xenXMListIterator(void *payload ATTRIBUTE_UNUSED, const char *name, void *data) {
+    struct xenXMListIteratorContext *ctx = data;
     virDomainPtr dom = NULL;
 
     if (ctx->count == ctx->max)
-- 
1.6.2.5


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