From 3d22063ebd4cfa8b54ec3e83a04e92770c6d7319 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Tue, 28 Nov 2017 10:48:24 +0100 Subject: [PATCH] core: timer - use uint type instead of short for flags and slow index - get rid of unused padding field --- src/core/timer.c | 2 +- src/core/timer.h | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/core/timer.c b/src/core/timer.c index 3a4e610f3e6..0e0dc8812e9 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -530,7 +530,7 @@ static inline int _timer_add(ticks_t t, struct timer_ln* tl) ticks_t delta; #ifdef USE_SLOW_TIMER - tl->flags&=~((unsigned short)F_TIMER_ON_SLOW_LIST); + tl->flags&=~(F_TIMER_ON_SLOW_LIST); tl->slow_idx=0; #endif delta=tl->initial_timeout; diff --git a/src/core/timer.h b/src/core/timer.h index 6414fb106b9..3b1669ab195 100644 --- a/src/core/timer.h +++ b/src/core/timer.h @@ -52,7 +52,7 @@ #ifdef USE_SLOW_TIMER #include -typedef unsigned short slow_idx_t; /* type fot the slow index */ +typedef unsigned int slow_idx_t; /* type fot the slow index */ extern pid_t slow_timer_pid; #endif @@ -102,11 +102,9 @@ struct timer_ln{ /* timer_link already used in tm */ ticks_t initial_timeout; void* data; timer_handler_f* f; - volatile unsigned short flags; + volatile unsigned int flags; #ifdef USE_SLOW_TIMER volatile slow_idx_t slow_idx; -#else - unsigned short reserved; #endif #ifdef TIMER_DEBUG unsigned int expires_no; /* timer handler calls */ @@ -144,15 +142,13 @@ void timer_free(struct timer_ln* t); /* use for a deleted/expired timer that you want to add again */ #define timer_reinit(tl) \ do{ \ - (tl)->flags&=~((unsigned short)(F_TIMER_ON_SLOW_LIST | \ - F_TIMER_ACTIVE));\ + (tl)->flags&=~(F_TIMER_ON_SLOW_LIST | F_TIMER_ACTIVE);\ (tl)->init++; \ }while(0) #else /* use for a deleted/expired timer that you want to add again */ #define timer_reinit(tl) \ - (tl)->flags&=~((unsigned short)(F_TIMER_ON_SLOW_LIST | \ - F_TIMER_ACTIVE)) + (tl)->flags&=~(F_TIMER_ON_SLOW_LIST | F_TIMER_ACTIVE) #endif #define timer_init(tl, fun, param, flgs) \