shash: New function shash_count().
authorBen Pfaff <blp@nicira.com>
Wed, 4 Nov 2009 22:56:03 +0000 (14:56 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 4 Nov 2009 23:01:02 +0000 (15:01 -0800)
lib/shash.c
lib/shash.h

index 5d8ecfa..0021747 100644 (file)
@@ -58,6 +58,12 @@ shash_is_empty(const struct shash *shash)
     return hmap_is_empty(&shash->map);
 }
 
+size_t
+shash_count(const struct shash *shash)
+{
+    return hmap_count(&shash->map);
+}
+
 /* It is the caller's responsibility to avoid duplicate names, if that is
  * desirable. */
 struct shash_node *
index 56f13bc..67be119 100644 (file)
@@ -42,6 +42,7 @@ void shash_init(struct shash *);
 void shash_destroy(struct shash *);
 void shash_clear(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 *, void *);
 void shash_delete(struct shash *, struct shash_node *);
 struct shash_node *shash_find(const struct shash *, const char *);