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

2018-07-10 Thread Eric Anholt
Caio Marcelo de Oliveira Filho  writes:

> On Thu, Jul 05, 2018 at 01:56:11PM -0700, Eric Anholt wrote:
>> Caio Marcelo de Oliveira Filho  writes:
>> 
>> > ---
>> 
>> This one should be trivial to unit test, with a present and non-present
>> key.
>
> Done.
>
> Do you want the equivalent hash_table function even if I don't have
> use for it in the code at the moment?

It would be nice.  Given that the files started out as basically a sed
job, I like keeping them matching in API so you know what to expect once
you've used one or the other.


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2018-07-09 Thread Caio Marcelo de Oliveira Filho
On Thu, Jul 05, 2018 at 01:56:11PM -0700, Eric Anholt wrote:
> Caio Marcelo de Oliveira Filho  writes:
> 
> > ---
> 
> This one should be trivial to unit test, with a present and non-present
> key.

Done.

Do you want the equivalent hash_table function even if I don't have
use for it in the code at the moment?


Thanks,
Caio


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2018-07-05 Thread Eric Anholt
Caio Marcelo de Oliveira Filho  writes:

> ---

This one should be trivial to unit test, with a present and non-present
key.


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2018-06-27 Thread Caio Marcelo de Oliveira Filho
---
 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

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev