[Mesa-dev] [PATCH 06/10] util/set: helper to remove entry by key

Caio Marcelo de Oliveira Filho caio.oliveira at intel.com
Thu Jun 28 01:18:32 UTC 2018


---
 src/util/set.c | 9 +++++++++
 src/util/set.h | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/src/util/set.c b/src/util/set.c
index b2aa5ba13d5..feef96d16ea 100644
--- a/src/util/set.c
+++ b/src/util/set.c
@@ -383,6 +383,15 @@ _mesa_set_remove(struct set *ht, struct set_entry *entry)
    ht->deleted_entries++;
 }
 
+/**
+ * Removes the entry with the corresponding key, if exists.
+ */
+void
+_mesa_set_remove_key(struct set *set, const void *key)
+{
+   _mesa_set_remove(set, _mesa_set_search(set, key));
+}
+
 /**
  * This function is an iterator over the hash table.
  *
diff --git a/src/util/set.h b/src/util/set.h
index 4db070a6f10..ffd19a798bd 100644
--- a/src/util/set.h
+++ b/src/util/set.h
@@ -81,6 +81,8 @@ _mesa_set_search_pre_hashed(const struct set *set, uint32_t hash,
 
 void
 _mesa_set_remove(struct set *set, struct set_entry *entry);
+void
+_mesa_set_remove_key(struct set *set, const void *key);
 
 struct set_entry *
 _mesa_set_next_entry(const struct set *set, struct set_entry *entry);
-- 
2.17.1



More information about the mesa-dev mailing list