summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Denis <chrysalis@users.sourceforge.net>2010-05-03 11:37:16 -0400
committerNick Mathewson <nickm@torproject.org>2010-05-03 11:40:09 -0400
commit71afc525804f416cfaabf4ec253f725fe3ec6822 (patch)
treea4b9df50ebbb71a64dfd186425cfc07f63ed3f38
parent953e2290fc9a649c465d5bcc7b26bdb0d5693c3b (diff)
downloadlibevent-71afc525804f416cfaabf4ec253f725fe3ec6822.tar.gz
Fix nonstandard TAILQ_FOREACH_REVERSE() definition
Every current BSD system providing TAILQ_* macros define TAILQ_FOREACH_REVERSE in this order: TAILQ_FOREACH_REVERSE(var, head, field, headname) However, libevent defines it in another order: TAILQ_FOREACH_REVERSE(var, head, headname, field) Here's a trivial patch to have libevent compatible with stock queue.h headers. -Frank. [From sourceforge patch 2995179. codesearch.google.com confirms that the only people defining TAILQ_FOREACH_REVERSE our way are people using it in a compatibility header like us. Did we copy this from OpenSSH or something?] -Nick
-rw-r--r--compat/sys/queue.h2
-rw-r--r--event.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/compat/sys/queue.h b/compat/sys/queue.h
index 7bb87c29..53dd10d9 100644
--- a/compat/sys/queue.h
+++ b/compat/sys/queue.h
@@ -306,7 +306,7 @@ struct { \
(var) != TAILQ_END(head); \
(var) = TAILQ_NEXT(var, field))
-#define TAILQ_FOREACH_REVERSE(var, head, field, headname) \
+#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
for((var) = TAILQ_LAST(head, headname); \
(var) != TAILQ_END(head); \
(var) = TAILQ_PREV(var, headname, field))
diff --git a/event.c b/event.c
index cfd2db9f..cfa0cbfe 100644
--- a/event.c
+++ b/event.c
@@ -2361,7 +2361,7 @@ insert_common_timeout_inorder(struct common_timeout_list *ctl,
* the end of 'ev' to find the right insertion point.
*/
TAILQ_FOREACH_REVERSE(e, &ctl->events,
- ev_timeout_pos.ev_next_with_common_timeout, event_list) {
+ event_list, ev_timeout_pos.ev_next_with_common_timeout) {
/* This timercmp is a little sneaky, since both ev and e have
* magic values in tv_usec. Fortunately, they ought to have
* the _same_ magic values in tv_usec. Let's assert for that.