summaryrefslogtreecommitdiff
path: root/src
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
parent803185fc973aebb5a24bf08f4cb4d8a3d3e96d16 (diff)
downloadouroboros-0.9.5.tar.gz
ouroboros-0.9.5.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')
-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);