summaryrefslogtreecommitdiff
path: root/minheap-internal.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-09-23 22:45:55 -0400
committerNick Mathewson <nickm@torproject.org>2010-09-23 22:45:55 -0400
commit9c8db0f804360325e37f032c56c46ef627d2aaf7 (patch)
treeb41270caa2ab37509228528f4b69d0599412f5c2 /minheap-internal.h
parent045eef4cdea75c12be49327f961d6d2002c105dd (diff)
downloadlibevent-9c8db0f804360325e37f032c56c46ef627d2aaf7.tar.gz
Fix all warnings in the main codebase flagged by -Wsigned-compare
Remember, the code int is_less_than(int a, unsigned b) { return a < b; } is buggy, since the C integer promotion rules basically turn it into int is_less_than(int a, unsigned b) { return ((unsigned)a) < b; } and we really want something closer to int is_less_than(int a, unsigned b) { return a < 0 || ((unsigned)a) < b; } . Suggested by an example from Ralph Castain
Diffstat (limited to 'minheap-internal.h')
-rw-r--r--minheap-internal.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/minheap-internal.h b/minheap-internal.h
index 0557c2ba..9734a7c7 100644
--- a/minheap-internal.h
+++ b/minheap-internal.h
@@ -95,7 +95,7 @@ int min_heap_elt_is_top(const struct event *e)
int min_heap_erase(min_heap_t* s, struct event* e)
{
- if (((unsigned int)-1) != e->ev_timeout_pos.min_heap_idx)
+ if (-1 != e->ev_timeout_pos.min_heap_idx)
{
struct event *last = s->p[--s->n];
unsigned parent = (e->ev_timeout_pos.min_heap_idx - 1) / 2;