secgateway/Platform/user/trace/trace-api/collection.h

28 lines
906 B
C
Raw Normal View History

#ifndef _COLLECTION_H
#define _COLLECTION_H
#include <stdint.h>
#include "trace_api.h"
#include "list.h"
#define COLLECT_HLIST_CLEAR(pos, n, head, count, member, free_cb) \
{ \
for (uint16_t i = 0; i < count; i++) { \
hlist_for_each_entry_safe(pos, n, &head[i], node) { \
hlist_del(&pos->member); \
free_cb(pos); \
} \
} \
}
static inline trace_ret_t collect_hlist_init(struct hlist_head *h, const uint16_t count)
{
for (uint16_t i = 0; i < count; i++) {
INIT_HLIST_HEAD(&h[i]);
}
return TRACE_SUCCESS;
}
#endif