diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-12-04 09:35:37 +1100 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-12-04 09:35:37 +1100 |
commit | 0c6a63cd61a66168e7f9f4d4c248e519a920f3fb (patch) | |
tree | aa244a7d6e210ba33cad161dd59b09c326c799e8 | |
parent | aa7984d147b5ef09ad287a2a2fb034050a5d8e7c (diff) |
Remove -fno-strict-aliasing and fix aliasing issue
Remove -fno-struict-aliasing as I think the code is generally
safe due to the proper use of unions when an object can have
multiple different types. twin_timeout.c did have some dodgy
casts that I removed.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | twin_timeout.c | 25 |
2 files changed, 13 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac index cbbd6b3..e5970a7 100644 --- a/configure.ac +++ b/configure.ac @@ -47,7 +47,7 @@ WARN_CFLAGS="" if test "x$GCC" = "xyes"; then WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \ -Wmissing-prototypes -Wmissing-declarations \ - -Wnested-externs -fno-strict-aliasing" + -Wnested-externs" fi AC_SUBST(WARN_CFLAGS) diff --git a/twin_timeout.c b/twin_timeout.c index 189b305..eeffc5f 100644 --- a/twin_timeout.c +++ b/twin_timeout.c @@ -21,8 +21,8 @@ #include "twinint.h" -static twin_timeout_t *head; -static twin_time_t start; +static twin_queue_t *head; +static twin_time_t start; static twin_order_t _twin_timeout_order (twin_queue_t *a, twin_queue_t *b) @@ -41,10 +41,9 @@ static void _twin_queue_timeout (twin_timeout_t *timeout, twin_time_t time) { timeout->time = time; - _twin_queue_remove ((twin_queue_t **) &head, - &timeout->queue); - _twin_queue_insert ((twin_queue_t **) &head, - _twin_timeout_order, &timeout->queue); + _twin_queue_remove (&head, &timeout->queue); + _twin_queue_insert (&head, + _twin_timeout_order, &timeout->queue); } void @@ -55,7 +54,7 @@ _twin_run_timeout (void) twin_timeout_t *first; twin_time_t delay; - first = (twin_timeout_t *) _twin_queue_set_order ((twin_queue_t **) &head); + first = (twin_timeout_t *) _twin_queue_set_order (&head); for (timeout = first; timeout && twin_time_compare (now, >=, timeout->time); timeout = (twin_timeout_t *) timeout->queue.order) @@ -64,12 +63,11 @@ _twin_run_timeout (void) if (delay >= 0) { timeout->time = twin_now() + delay; - _twin_queue_reorder ((twin_queue_t **) &head, + _twin_queue_reorder (&head, _twin_timeout_order, &timeout->queue); } else - _twin_queue_delete ((twin_queue_t **) &head, - &timeout->queue); + _twin_queue_delete (&head, &timeout->queue); } _twin_queue_review_order (&first->queue); } @@ -96,7 +94,7 @@ twin_set_timeout (twin_timeout_proc_t timeout_proc, void twin_clear_timeout (twin_timeout_t *timeout) { - _twin_queue_delete ((twin_queue_t **) &head, &timeout->queue); + _twin_queue_delete (&head, &timeout->queue); } twin_time_t @@ -104,10 +102,11 @@ _twin_timeout_delay (void) { if (head) { + twin_timeout_t *thead = (twin_timeout_t *)head; twin_time_t now = twin_now(); - if (twin_time_compare (now, >=, head->time)) + if (twin_time_compare (now, >=, thead->time)) return 0; - return head->time - now; + return thead->time - now; } return -1; } |