summaryrefslogtreecommitdiff
path: root/src/mesa/program/hash_table.h
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-08-16 19:08:53 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-08-16 19:08:53 -0700
commit6c03c576cc49bbb008de66d374f4302ff0fe0390 (patch)
tree7ddeb3ee88532d9aef8728b9aa256edf7c125247 /src/mesa/program/hash_table.h
parent15a3b42e135a3a2cb463ec3cff80a55dd8528051 (diff)
parenta433cd286c60eb9d4c2114f042709eda0f3de676 (diff)
Merge branch 'glsl2'
Conflicts: src/mesa/program/prog_optimize.c
Diffstat (limited to 'src/mesa/program/hash_table.h')
-rw-r--r--src/mesa/program/hash_table.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/mesa/program/hash_table.h b/src/mesa/program/hash_table.h
index e750906f96..f1c4fdcd1f 100644
--- a/src/mesa/program/hash_table.h
+++ b/src/mesa/program/hash_table.h
@@ -36,6 +36,10 @@ struct hash_table;
typedef unsigned (*hash_func_t)(const void *key);
typedef int (*hash_compare_func_t)(const void *key1, const void *key2);
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* Hash table constructor
*
@@ -88,6 +92,10 @@ extern void *hash_table_find(struct hash_table *ht, const void *key);
extern void hash_table_insert(struct hash_table *ht, void *data,
const void *key);
+/**
+ * Remove a specific element from a hash table.
+ */
+extern void hash_table_remove(struct hash_table *ht, const void *key);
/**
* Compute hash value of a string
@@ -112,4 +120,31 @@ extern unsigned hash_table_string_hash(const void *key);
*/
#define hash_table_string_compare ((hash_compare_func_t) strcmp)
+
+/**
+ * Compute hash value of a pointer
+ *
+ * \param key Pointer to be used as a hash key
+ *
+ * \note
+ * The memory pointed to by \c key is \b never accessed. The value of \c key
+ * itself is used as the hash key
+ *
+ * \sa hash_table_pointer_compare
+ */
+unsigned
+hash_table_pointer_hash(const void *key);
+
+
+/**
+ * Compare two pointers used as keys
+ *
+ * \sa hash_table_pointer_hash
+ */
+int
+hash_table_pointer_compare(const void *key1, const void *key2);
+
+#ifdef __cplusplus
+}
+#endif
#endif /* HASH_TABLE_H */