}
}
+/* Like shash_destroy(), but also free() each node's 'data'. */
+void
+shash_destroy_free_data(struct shash *sh)
+{
+ if (sh) {
+ shash_clear_free_data(sh);
+ hmap_destroy(&sh->map);
+ }
+}
+
void
shash_swap(struct shash *a, struct shash *b)
{
}
}
+/* Like shash_clear(), but also free() each node's 'data'. */
+void
+shash_clear_free_data(struct shash *sh)
+{
+ struct shash_node *node, *next;
+
+ SHASH_FOR_EACH_SAFE (node, next, sh) {
+ hmap_remove(&sh->map, &node->node);
+ free(node->data);
+ free(node->name);
+ free(node);
+ }
+}
+
bool
shash_is_empty(const struct shash *shash)
{
void shash_init(struct shash *);
void shash_destroy(struct shash *);
+void shash_destroy_free_data(struct shash *);
void shash_swap(struct shash *, struct shash *);
void shash_moved(struct shash *);
void shash_clear(struct shash *);
+void shash_clear_free_data(struct shash *);
bool shash_is_empty(const struct shash *);
size_t shash_count(const struct shash *);
struct shash_node *shash_add(struct shash *, const char *, const void *);