✨ feat(utils.h add count_of): mq clean using count_of
This commit is contained in:
@@ -35,6 +35,10 @@
|
||||
(type *)( (char *)__mptr - offsetof(type,member) ); })
|
||||
#endif
|
||||
|
||||
#ifndef count_of
|
||||
#define count_of(x) (sizeof(x) / sizeof(0 [x]))
|
||||
#endif
|
||||
|
||||
#ifndef likely
|
||||
#define likely(x) __builtin_expect((x), 1)
|
||||
#endif /* likely */
|
||||
|
||||
@@ -135,7 +135,7 @@ void mq_runtime_clean(struct mq_runtime *rt)
|
||||
struct mq_topic *topic;
|
||||
rt->publish_enabled=false;
|
||||
|
||||
for (int i = 0; i < STELLAR_MQ_MAX; i++)
|
||||
for (unsigned long i = 0; i < count_of(rt->priority_mq); i++)
|
||||
{
|
||||
DL_FOREACH_SAFE(rt->priority_mq[i], mq_elt, tmp)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user