summaryrefslogtreecommitdiff
path: root/src/lib/timerwheel.c
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2018-01-29 12:10:25 +0100
committerDimitri Staessens <[email protected]>2018-01-29 13:10:29 +0100
commit98a306ff278884bfcbea41b059f2467226a9ced9 (patch)
tree92777cc228c6e2bde6df210ea0a97f0880641e70 /src/lib/timerwheel.c
parent803185fc973aebb5a24bf08f4cb4d8a3d3e96d16 (diff)
downloadouroboros-98a306ff278884bfcbea41b059f2467226a9ced9.tar.gz
ouroboros-98a306ff278884bfcbea41b059f2467226a9ced9.zip
lib: Fix bad comparison in timerwheel0.9.5
A comparison was done in the timerwheel between an unsigned value and a time_t. Signed-off-by: Sander Vrijders <[email protected]> Signed-off-by: Dimitri Staessens <[email protected]>
Diffstat (limited to 'src/lib/timerwheel.c')
-rw-r--r--src/lib/timerwheel.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/timerwheel.c b/src/lib/timerwheel.c
index 391e805b..60fa9cda 100644
--- a/src/lib/timerwheel.c
+++ b/src/lib/timerwheel.c
@@ -60,7 +60,7 @@ struct timerwheel {
pthread_mutex_t lock;
time_t resolution;
- unsigned int elements;
+ size_t elements;
};
static void tw_el_fini(struct tw_el * e)
@@ -111,7 +111,7 @@ struct timerwheel * timerwheel_create(time_t resolution,
struct timespec now = {0, 0};
struct timespec res_ts = {resolution / 1000,
(resolution % 1000) * MILLION};
- unsigned long i;
+ size_t i;
struct timerwheel * tw;
@@ -126,7 +126,7 @@ struct timerwheel * timerwheel_create(time_t resolution,
tw->elements = 1;
- while (tw->elements < max_delay / resolution)
+ while (tw->elements < (size_t) max_delay / resolution)
tw->elements <<= 1;
tw->wheel = malloc(sizeof(*tw->wheel) * tw->elements);