summaryrefslogtreecommitdiffstats
path: root/src/util/set.h
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2019-05-10 13:37:42 -0500
committerJason Ekstrand <[email protected]>2019-05-13 14:43:47 +0000
commitabb450870e8a8fc590e53b21f3ff2a4db42536dd (patch)
treeba8b324acb026e26a8f2f61a0c996232040a3f65 /src/util/set.h
parent460567eabf735003059ed24068d21b159d309896 (diff)
util/set: Add a search_and_add function
This function is identical to _mesa_set_add except that it takes an extra out parameter that lets the caller detect if a replacement happened. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
Diffstat (limited to 'src/util/set.h')
-rw-r--r--src/util/set.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util/set.h b/src/util/set.h
index 307a2e46765..7d277c59f8b 100644
--- a/src/util/set.h
+++ b/src/util/set.h
@@ -79,6 +79,12 @@ struct set_entry *
_mesa_set_search_pre_hashed(const struct set *set, uint32_t hash,
const void *key);
+struct set_entry *
+_mesa_set_search_and_add(struct set *set, const void *key, bool *replaced);
+struct set_entry *
+_mesa_set_search_and_add_pre_hashed(struct set *set, uint32_t hash,
+ const void *key, bool *replaced);
+
void
_mesa_set_remove(struct set *set, struct set_entry *entry);
void