- HMAP_FOR_EACH_SAFE (node, next, struct shash_node, node, &sh->map) {
+ SHASH_FOR_EACH_SAFE (node, next, sh) {
-/* It is the caller's responsible to avoid duplicate names, if that is
+bool
+shash_is_empty(const struct shash *shash)
+{
+ return hmap_is_empty(&shash->map);
+}
+
+/* It is the caller's responsibility to avoid duplicate names, if that is
shash_add(struct shash *sh, const char *name, void *data)
{
struct shash_node *node = xmalloc(sizeof *node);
node->name = xstrdup(name);
node->data = data;
hmap_insert(&sh->map, &node->node, hash_name(name));
shash_add(struct shash *sh, const char *name, void *data)
{
struct shash_node *node = xmalloc(sizeof *node);
node->name = xstrdup(name);
node->data = data;
hmap_insert(&sh->map, &node->node, hash_name(name));
struct shash_node *node = shash_find(sh, name);
return node ? node->data : NULL;
}
struct shash_node *node = shash_find(sh, name);
return node ? node->data : NULL;
}