]> git.ozlabs.org Git - ccan/blobdiff - ccan/htable/htable.h
htable: add htable_count().
[ccan] / ccan / htable / htable.h
index 938b43afc89ce5a6603c45761da17d26b748475e..0ecae726c0bd560a5a1ba598e4d544d7480041a4 100644 (file)
@@ -75,6 +75,15 @@ bool htable_init_sized(struct htable *ht,
                       size_t (*rehash)(const void *elem, void *priv),
                       void *priv, size_t size);
 
+/**
+ * htable_count - count number of entries in a hash table.
+ * @ht: the hash table
+ */
+static inline size_t htable_count(const struct htable *ht)
+{
+       return ht->elems;
+}
+
 /**
  * htable_clear - empty a hash table.
  * @ht: the hash table to clear