#include <stdlib.h>
+#include "macros.h"
#include "set.h"
-#include "ralloc.h"
-
-#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
+#include "util/ralloc.h"
/*
* From Knuth -- a good choice for hash/rehash values is p, p-2 where
struct set *
_mesa_set_create(void *mem_ctx,
- bool key_equals_function(const void *a,
- const void *b))
+ bool (*key_equals_function)(const void *a,
+ const void *b))
{
struct set *ht;
if (ht == NULL)
return NULL;
- ht->mem_ctx = mem_ctx;
ht->size_index = 0;
ht->size = hash_sizes[ht->size_index].size;
ht->rehash = hash_sizes[ht->size_index].rehash;
int (*predicate)(struct set_entry *entry))
{
struct set_entry *entry;
- uint32_t i = random() % ht->size;
+ uint32_t i = rand() % ht->size;
if (ht->entries == 0)
return NULL;