X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fhmap.h;h=1592f803bedb17bd9c1ca4dc285f5bd6e72fd1c4;hb=0fceec79d3899bbd8de88497ad127a56a68700e2;hp=c9e764dec563a92df08491839259e5f061884963;hpb=cb586666724d5fcbdb658ce471b85484f0a7babe;p=pspp-builds.git diff --git a/src/libpspp/hmap.h b/src/libpspp/hmap.h index c9e764de..1592f803 100644 --- a/src/libpspp/hmap.h +++ b/src/libpspp/hmap.h @@ -115,6 +115,7 @@ } */ +#include #include #include @@ -182,6 +183,7 @@ static inline struct hmap_node *hmap_next (const struct hmap *, const struct hmap_node *); /* Counting. */ +static bool hmap_is_empty (const struct hmap *); static inline size_t hmap_count (const struct hmap *); static inline size_t hmap_capacity (const struct hmap *); @@ -442,6 +444,14 @@ hmap_next (const struct hmap *map, const struct hmap_node *node) : hmap_first_nonempty_bucket__ (map, (node->hash & map->mask) + 1)); } +/* Returns true if MAP currently contains no data items, false + otherwise. */ +static inline bool +hmap_is_empty (const struct hmap *map) +{ + return map->count == 0; +} + /* Returns the number of data items currently in MAP. */ static inline size_t hmap_count (const struct hmap *map)