util/set: add the found param to search_or_add

this brings parity with the internal api

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8450>
This commit is contained in:
Mike Blumenkrantz
2021-01-07 09:38:52 -05:00
committed by Marge Bot
parent 5f3f128088
commit 491e7decad
4 changed files with 12 additions and 8 deletions
+6 -2
View File
@@ -143,12 +143,16 @@ TEST(set, search_or_add)
_mesa_set_add(s, &b);
EXPECT_EQ(s->entries, 2);
struct set_entry *entry = _mesa_set_search_or_add(s, &c);
bool found = false;
struct set_entry *entry = _mesa_set_search_or_add(s, &c, &found);
EXPECT_EQ(entry->key, (void *)&b);
EXPECT_EQ(found, true);
EXPECT_EQ(s->entries, 2);
struct set_entry *entry3 = _mesa_set_search_or_add(s, &d);
found = false;
struct set_entry *entry3 = _mesa_set_search_or_add(s, &d, &found);
EXPECT_EQ(entry3->key, &d);
EXPECT_EQ(found, false);
EXPECT_EQ(s->entries, 3);
_mesa_set_destroy(s, NULL);