diff options
author | Julien Dessaux | 2019-09-12 18:01:35 +0200 |
---|---|---|
committer | Julien Dessaux | 2019-09-12 18:01:35 +0200 |
commit | 91701367ad7f2a2ac7c35ea9ed796b0a4a2a0b12 (patch) | |
tree | 9ab0bfddf4477cb8cf842d5cbf932e78bdbbcea4 | |
parent | Changed subscription id to rid (diff) | |
download | rocket-cli-client-91701367ad7f2a2ac7c35ea9ed796b0a4a2a0b12.tar.gz rocket-cli-client-91701367ad7f2a2ac7c35ea9ed796b0a4a2a0b12.tar.bz2 rocket-cli-client-91701367ad7f2a2ac7c35ea9ed796b0a4a2a0b12.zip |
Added function to count subscriptions
-rw-r--r-- | common/subscriptions.c | 5 | ||||
-rw-r--r-- | common/subscriptions.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/common/subscriptions.c b/common/subscriptions.c index 9c8c345..529c339 100644 --- a/common/subscriptions.c +++ b/common/subscriptions.c @@ -38,3 +38,8 @@ void common_subscriptions_const_walk(const struct subscription* subscriptions, v func(sub); } } + +size_t common_subscriptions_count(const struct subscription* subscriptions) +{ + return HASH_COUNT(subscriptions); +} diff --git a/common/subscriptions.h b/common/subscriptions.h index 0ade221..3e195bb 100644 --- a/common/subscriptions.h +++ b/common/subscriptions.h @@ -25,5 +25,6 @@ void common_subscription_add(struct subscription** subscriptions, const char* id struct subscription* common_subscription_new(const char* rid, const char* name, enum subscription_type type, size_t unread); void common_subscriptions_free(struct subscription* subscriptions); void common_subscriptions_const_walk(const struct subscription* subscriptions, void (*func)(const struct subscription*)); +size_t common_subscriptions_count(const struct subscription* subscriptions); #endif |