Skip to content

Commit c01da22

Browse files
committed
shash: New function shash_count().
1 parent 837e809 commit c01da22

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

lib/shash.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ shash_is_empty(const struct shash *shash)
5858
return hmap_is_empty(&shash->map);
5959
}
6060

61+
size_t
62+
shash_count(const struct shash *shash)
63+
{
64+
return hmap_count(&shash->map);
65+
}
66+
6167
/* It is the caller's responsibility to avoid duplicate names, if that is
6268
* desirable. */
6369
struct shash_node *

lib/shash.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ void shash_init(struct shash *);
4242
void shash_destroy(struct shash *);
4343
void shash_clear(struct shash *);
4444
bool shash_is_empty(const struct shash *);
45+
size_t shash_count(const struct shash *);
4546
struct shash_node *shash_add(struct shash *, const char *, void *);
4647
void shash_delete(struct shash *, struct shash_node *);
4748
struct shash_node *shash_find(const struct shash *, const char *);

0 commit comments

Comments
 (0)