提交 cf577653 编写于 作者: D Daniel P. Berrange

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
上级 de2b252d
......@@ -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)
......
......@@ -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);
......
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册