]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Remove bogus const annotations to hash iterator
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 14 Oct 2009 10:17:24 +0000 (11:17 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 19 Oct 2009 15:24:12 +0000 (16:24 +0100)
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
src/util/hash.h
src/xen/xm_internal.c

index 42a28d1d6d2b7a0f460cd3f0e229d83fdeb663ee..40df2c63c9cf93c8ac139b578683bef2de9bcbeb 100644 (file)
@@ -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)
index 777890991e35b04d802aa8280b516b92f070dadb..a163f105814953b1f72f205487169a826a852a34 100644 (file)
@@ -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);
 
index ebbaae89f964c514338f4f7ef2151b57c5d7112e..732b2d3c787a65a540e3e30ae39deb04fa2c61bd 100644 (file)
@@ -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)