2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-02 23:35:27 +00:00

shash: New function shash_find_and_delete().

This commit is contained in:
Ben Pfaff
2009-10-28 11:10:36 -07:00
parent 3adb8bf048
commit 837e80977c
2 changed files with 14 additions and 0 deletions

View File

@@ -100,6 +100,19 @@ shash_find_data(const struct shash *sh, const char *name)
return node ? node->data : NULL;
}
void *
shash_find_and_delete(struct shash *sh, const char *name)
{
struct shash_node *node = shash_find(sh, name);
if (node) {
void *data = node->data;
shash_delete(sh, node);
return data;
} else {
return NULL;
}
}
struct shash_node *
shash_first(const struct shash *shash)
{