mesa: Upload boolean uniforms using UniformBooleanTrue.
[mesa.git] / src / mesa / main / set.c
index fe8f6d221b0fab074bba334c4f27b80cbedafc00..52c1dabd82b4b52ecd646fc5b6ac1980e63a8327 100644 (file)
 
 #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
@@ -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;