diff options
| author | William Ahern <[email protected]> | 2016-02-24 10:27:58 -0800 |
|---|---|---|
| committer | William Ahern <[email protected]> | 2016-02-24 10:27:58 -0800 |
| commit | 5ecfc012befdb577fdbaf6e6c74ca55b6ce6c26e (patch) | |
| tree | 1379b6060a7b4b252e3ce24cb396d521f13056e7 /timeout.c | |
| parent | 825de345e97f751033613cba059e7e7990e6e79d (diff) | |
| parent | e7c5a9e08b206c97b1111eef8dcb03a19ee459ea (diff) | |
Merge branch 'optional_timeout_ptr' of git://github.com/nmathewson/timeout into nmathewson-optional_timeout_ptr
Diffstat (limited to 'timeout.c')
| -rw-r--r-- | timeout.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -43,6 +43,11 @@ #include "debug.h" #endif +#ifdef TIMEOUT_DISABLE_RELATIVE_ACCESS +#define TO_SET_TIMEOUTS(to, T) ((void)0) +#else +#define TO_SET_TIMEOUTS(to, T) ((to)->timeouts = (T)) +#endif /* * A N C I L L A R Y R O U T I N E S @@ -260,7 +265,7 @@ static void timeouts_reset(struct timeouts *T) { TAILQ_CONCAT(&reset, &T->expired, tqe); TAILQ_FOREACH(to, &reset, tqe) { - to->timeouts = NULL; + TO_SET_TIMEOUTS(to, NULL); to->pending = NULL; } } /* timeouts_reset() */ @@ -295,7 +300,7 @@ TIMEOUT_PUBLIC void timeouts_del(struct timeouts *T, struct timeout *to) { } to->pending = NULL; - to->timeouts = NULL; + TO_SET_TIMEOUTS(to, NULL); } } /* timeouts_del() */ @@ -324,7 +329,7 @@ static void timeouts_sched(struct timeouts *T, struct timeout *to, timeout_t exp to->expires = expires; - to->timeouts = T; + TO_SET_TIMEOUTS(to, T); if (expires > T->curtime) { rem = timeout_rem(T, to); @@ -547,7 +552,7 @@ TIMEOUT_PUBLIC struct timeout *timeouts_get(struct timeouts *T) { if ((to->flags & TIMEOUT_INT) && to->interval > 0) { timeouts_readd(T, to); } else { - to->timeouts = 0; + TO_SET_TIMEOUTS(to, NULL); } return to; @@ -686,6 +691,7 @@ TIMEOUT_PUBLIC struct timeout *timeout_init(struct timeout *to, int flags) { } /* timeout_init() */ +#ifndef TIMEOUT_DISABLE_RELATIVE_ACCESS TIMEOUT_PUBLIC bool timeout_pending(struct timeout *to) { return to->pending && to->pending != &to->timeouts->expired; } /* timeout_pending() */ @@ -699,6 +705,7 @@ TIMEOUT_PUBLIC bool timeout_expired(struct timeout *to) { TIMEOUT_PUBLIC void timeout_del(struct timeout *to) { timeouts_del(to->timeouts, to); } /* timeout_del() */ +#endif /* |
