isl_hash_table_foreach: pass pointer to entry data
authorSven Verdoolaege <skimo@kotnet.org>
Mon, 26 Jul 2010 21:05:32 +0000 (23:05 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Fri, 30 Jul 2010 19:57:42 +0000 (21:57 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
include/isl_hash.h
isl_hash.c
isl_stream.c

index 97e008b..53eda85 100644 (file)
@@ -66,8 +66,8 @@ struct isl_hash_table_entry *isl_hash_table_find(struct isl_ctx *ctx,
                                int (*eq)(const void *entry, const void *val),
                                const void *val, int reserve);
 int isl_hash_table_foreach(struct isl_ctx *ctx,
-                               struct isl_hash_table *table,
-                               int (*fn)(void *entry, void *user), void *user);
+                           struct isl_hash_table *table,
+                           int (*fn)(void **entry, void *user), void *user);
 void isl_hash_table_remove(struct isl_ctx *ctx,
                                struct isl_hash_table *table,
                                struct isl_hash_table_entry *entry);
index 5abf9fd..b7bac23 100644 (file)
@@ -163,7 +163,7 @@ struct isl_hash_table_entry *isl_hash_table_find(struct isl_ctx *ctx,
 
 int isl_hash_table_foreach(struct isl_ctx *ctx,
                                struct isl_hash_table *table,
-                               int (*fn)(void *entry, void *user), void *user)
+                               int (*fn)(void **entry, void *user), void *user)
 {
        size_t size;
        uint32_t h;
@@ -171,7 +171,7 @@ int isl_hash_table_foreach(struct isl_ctx *ctx,
        size = 1 << table->bits;
        for (h = 0; h < size; ++ h)
                if (table->entries[h].data &&
-                   fn(table->entries[h].data, user) < 0)
+                   fn(&table->entries[h].data, user) < 0)
                        return -1;
        
        return 0;
index 7e70a6e..90ca640 100644 (file)
@@ -538,9 +538,9 @@ int isl_stream_is_empty(struct isl_stream *s)
        return 0;
 }
 
-static int free_keyword(void *p, void *user)
+static int free_keyword(void **p, void *user)
 {
-       struct isl_keyword *keyword = p;
+       struct isl_keyword *keyword = *p;
 
        free(keyword->name);
        free(keyword);