mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
lws_dll_foreach_safe
This commit is contained in:
parent
30eb3e94ab
commit
8dd3383368
2 changed files with 16 additions and 0 deletions
|
@ -187,6 +187,11 @@ lws_dll_add_front(struct lws_dll *d, struct lws_dll *phead);
|
|||
LWS_VISIBLE LWS_EXTERN void
|
||||
lws_dll_remove(struct lws_dll *d);
|
||||
|
||||
/* another way to do lws_start_foreach_dll_safe() on a list via a cb */
|
||||
|
||||
LWS_VISIBLE LWS_EXTERN int
|
||||
lws_dll_foreach_safe(struct lws_dll *phead, int (*cb)(struct lws_dll *d));
|
||||
|
||||
struct lws_dll_lws { /* typed as struct lws * */
|
||||
struct lws_dll_lws *prev;
|
||||
struct lws_dll_lws *next;
|
||||
|
|
|
@ -138,6 +138,17 @@ lws_dll_remove(struct lws_dll *d)
|
|||
d->next = NULL;
|
||||
}
|
||||
|
||||
int
|
||||
lws_dll_foreach_safe(struct lws_dll *phead, int (*cb)(struct lws_dll *d))
|
||||
{
|
||||
lws_start_foreach_dll_safe(struct lws_dll *, p, tp, phead->next) {
|
||||
if (cb(p))
|
||||
return 1;
|
||||
} lws_end_foreach_dll_safe(p, tp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !(defined(LWS_PLAT_OPTEE) && !defined(LWS_WITH_NETWORK))
|
||||
|
||||
LWS_VISIBLE lws_usec_t
|
||||
|
|
Loading…
Add table
Reference in a new issue