X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fhtable%2Fhtable_type.h;h=9dad4b3927186ab661f6099eeb7e801ed9204277;hp=14011676903807fed252318ef5884b55f14e9556;hb=b98c68473e3317e09ebcc2d7d46e374fc08c531d;hpb=e16aa40bed387c9575bc9c5d1b19ecca0e9cbda7 diff --git a/ccan/htable/htable_type.h b/ccan/htable/htable_type.h index 14011676..9dad4b39 100644 --- a/ccan/htable/htable_type.h +++ b/ccan/htable/htable_type.h @@ -25,6 +25,9 @@ * void _clear(struct *); * bool _copy(struct *dst, const struct *src); * + * Count entries: + * size_t _count(const struct *ht); + * * Add function only fails if we run out of memory: * bool _add(struct *ht, const *e); * @@ -69,6 +72,10 @@ { \ return htable_init_sized(&ht->raw, name##_hash, NULL, s); \ } \ + static inline UNNEEDED size_t name##_count(const struct name *ht) \ + { \ + return htable_count(&ht->raw); \ + } \ static inline UNNEEDED void name##_clear(struct name *ht) \ { \ htable_clear(&ht->raw); \