*/
#include <stdlib.h>
-#include "isl_hash.h"
-#include "isl_ctx.h"
+#include <isl/hash.h>
+#include <isl/ctx.h>
uint32_t isl_hash_string(uint32_t hash, const char *s)
{
return hash;
}
+uint32_t isl_hash_mem(uint32_t hash, const void *p, size_t len)
+{
+ int i;
+ const char *s = p;
+ for (i = 0; i < len; ++i)
+ isl_hash_byte(hash, s[i]);
+ return hash;
+}
+
static unsigned int round_up(unsigned int v)
{
int old_v = v;
int isl_hash_table_foreach(struct isl_ctx *ctx,
struct isl_hash_table *table,
- int (*fn)(void *entry))
+ int (*fn)(void **entry, void *user), void *user)
{
size_t size;
uint32_t h;
size = 1 << table->bits;
for (h = 0; h < size; ++ h)
- if (table->entries[h].data && fn(table->entries[h].data) < 0)
+ if (table->entries[h].data &&
+ fn(&table->entries[h].data, user) < 0)
return -1;
return 0;