[sr-dev] git:5.1:1de066ee: core: timer - use uint type instead of short for flags and slow index

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[sr-dev] git:5.1:1de066ee: core: timer - use uint type instead of short for flags and slow index

Daniel-Constantin Mierla
Module: kamailio
Branch: 5.1
Commit: 1de066ee6e6360056dad4c6d19b3413f26e4759c
URL: https://github.com/kamailio/kamailio/commit/1de066ee6e6360056dad4c6d19b3413f26e4759c

Author: Daniel-Constantin Mierla <[hidden email]>
Committer: Daniel-Constantin Mierla <[hidden email]>
Date: 2017-12-04T09:25:02+01:00

core: timer - use uint type instead of short for flags and slow index

- get rid of unused padding field

(cherry picked from commit 3d22063ebd4cfa8b54ec3e83a04e92770c6d7319)

---

Modified: src/core/timer.c
Modified: src/core/timer.h

---

Diff:  https://github.com/kamailio/kamailio/commit/1de066ee6e6360056dad4c6d19b3413f26e4759c.diff
Patch: https://github.com/kamailio/kamailio/commit/1de066ee6e6360056dad4c6d19b3413f26e4759c.patch

---

diff --git a/src/core/timer.c b/src/core/timer.c
index 3a4e610f3e..0e0dc8812e 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 6414fb106b..3b1669ab19 100644
--- a/src/core/timer.h
+++ b/src/core/timer.h
@@ -52,7 +52,7 @@
 #ifdef USE_SLOW_TIMER
 #include <sys/types.h>
 
-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) \


_______________________________________________
Kamailio (SER) - Development Mailing List
[hidden email]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev