summaryrefslogtreecommitdiffstats
path: root/src/mesa/program/hash_table.h
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-08-17 11:51:15 -0700
committerIan Romanick <[email protected]>2011-10-04 12:33:28 -0700
commitacd834fde2e604173985be5d44cb2cf2b0cd5673 (patch)
treea2a9237fcaca11ba8dddb7cb836b373eaa87f1a5 /src/mesa/program/hash_table.h
parentb7fa0d0727a3a9e1f64d3cfc7a0f157b35dec09e (diff)
mesa: Add hash_table_replace
hash_table_replace doesn't use get_node to avoid having to hash the key twice. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/program/hash_table.h')
-rw-r--r--src/mesa/program/hash_table.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mesa/program/hash_table.h b/src/mesa/program/hash_table.h
index 746939c2273..e7ab067a3bd 100644
--- a/src/mesa/program/hash_table.h
+++ b/src/mesa/program/hash_table.h
@@ -93,11 +93,26 @@ extern void *hash_table_find(struct hash_table *ht, const void *key);
* If \c key is already in the hash table, it will be added again. Future
* calls to \c hash_table_find and \c hash_table_remove will return or remove,
* repsectively, the most recently added instance of \c key.
+ *
+ * \sa hash_table_replace
*/
extern void hash_table_insert(struct hash_table *ht, void *data,
const void *key);
/**
+ * Add an element to a hash table with replacement
+ *
+ * \warning
+ * If \c key is already in the hash table, \c data will \b replace the most
+ * recently inserted \c data (see the warning in \c hash_table_insert) for
+ * that key.
+ *
+ * \sa hash_table_insert
+ */
+extern void hash_table_replace(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);