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
This commit is contained in:
Daniel P. Berrange 2009-10-14 11:17:24 +01:00
parent de2b252df5
commit cf577653dc
3 changed files with 5 additions and 5 deletions

View 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)

View 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);

View 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)