util: Helper to create sets and hashes with pointer keys
[mesa.git] / src / util / set.c
index fe5b10f0fee4c35b28933ec0eef60b9531d4e528..18f1262e3f52bb199f3748f683fb97e6be628b44 100644 (file)
@@ -36,6 +36,7 @@
 #include <assert.h>
 #include <string.h>
 
 #include <assert.h>
 #include <string.h>
 
+#include "hash_table.h"
 #include "macros.h"
 #include "ralloc.h"
 #include "set.h"
 #include "macros.h"
 #include "ralloc.h"
 #include "set.h"
@@ -437,3 +438,13 @@ _mesa_set_random_entry(struct set *ht,
 
    return NULL;
 }
 
    return NULL;
 }
+
+/**
+ * Helper to create a set with pointer keys.
+ */
+struct set *
+_mesa_pointer_set_create(void *mem_ctx)
+{
+   return _mesa_set_create(mem_ctx, _mesa_hash_pointer,
+                           _mesa_key_pointer_equal);
+}