{
struct shash_node *node, *next;
- HMAP_FOR_EACH_SAFE (node, next, struct shash_node, node, &sh->map) {
+ SHASH_FOR_EACH_SAFE (node, next, sh) {
hmap_remove(&sh->map, &node->node);
free(node->name);
free(node);
#define SHASH_INITIALIZER(SHASH) { HMAP_INITIALIZER(&(SHASH)->map) }
+#define SHASH_FOR_EACH(SHASH_NODE, SHASH) \
+ HMAP_FOR_EACH (SHASH_NODE, struct shash_node, node, &(SHASH)->map)
+
+#define SHASH_FOR_EACH_SAFE(SHASH_NODE, NEXT, SHASH) \
+ HMAP_FOR_EACH_SAFE (SHASH_NODE, NEXT, struct shash_node, node, \
+ &(SHASH)->map)
+
void shash_init(struct shash *);
void shash_destroy(struct shash *);
void shash_clear(struct shash *);
struct shash_node *node;
ds_put_cstr(&ds, "The available commands are:\n");
- HMAP_FOR_EACH (node, struct shash_node, node, &commands.map) {
+ SHASH_FOR_EACH (node, &commands) {
ds_put_format(&ds, "\t%s\n", node->name);
}
unixctl_command_reply(conn, 214, ds_cstr(&ds));