Add LIST_ delaration to event_struct.h to supplment TAILQ_

Generally, LIST_ can be a little faster than TAILQ_ for most
operations.  We only need to use TAILQ_ when we care about traversing
lists from tail-to-head, or we need to be able to add items to the end
of the list.
This commit is contained in:
Nick Mathewson 2010-04-09 19:43:54 -04:00
parent 819f949f4a
commit f9db33d15d

View File

@ -69,6 +69,16 @@ struct { \
}
#endif /* !TAILQ_ENTRY */
/* Fix so that people don't have to run with <sys/queue.h> */
#ifndef LIST_ENTRY
#define _EVENT_DEFINED_LISTENTRY
#define LIST_ENTRY(type) \
struct { \
struct type *le_next; /* next element */ \
struct type **le_prev; /* address of previous next element */ \
}
#endif /* !TAILQ_ENTRY */
struct event_base;
struct event {
TAILQ_ENTRY (event) (ev_active_next);
@ -131,6 +141,14 @@ TAILQ_HEAD (event_list, event);
TAILQ_HEAD (evkeyvalq, evkeyval);
#endif /* _EVENT_DEFINED_TQENTRY */
#ifdef _EVENT_DEFINED_LISTENTRY
#undef LIST_ENTRY
struct event_dlist;
#undef _EVENT_DEFINED_LISTENTRY
#else
LIST_HEAD (event_dlist, event);
#endif /* _EVENT_DEFINED_LISTENTRY */
#ifdef __cplusplus
}
#endif