X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fset.c;h=52c1dabd82b4b52ecd646fc5b6ac1980e63a8327;hb=6df0fd8fe9ccf5c927797897277343f068420a45;hp=fe8f6d221b0fab074bba334c4f27b80cbedafc00;hpb=82c9d98ab9e8c0c94239551d84747b186d67ad73;p=mesa.git diff --git a/src/mesa/main/set.c b/src/mesa/main/set.c index fe8f6d221b0..52c1dabd82b 100644 --- a/src/mesa/main/set.c +++ b/src/mesa/main/set.c @@ -34,10 +34,9 @@ #include +#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 @@ -104,8 +103,8 @@ entry_is_present(struct set_entry *entry) 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; @@ -113,7 +112,6 @@ _mesa_set_create(void *mem_ctx, 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; @@ -324,7 +322,7 @@ _mesa_set_random_entry(struct set *ht, 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;