diff options
author | Nick Mathewson <nickm@torproject.org> | 2010-09-23 22:45:55 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2010-09-23 22:45:55 -0400 |
commit | 9c8db0f804360325e37f032c56c46ef627d2aaf7 (patch) | |
tree | b41270caa2ab37509228528f4b69d0599412f5c2 /log-internal.h | |
parent | 045eef4cdea75c12be49327f961d6d2002c105dd (diff) | |
download | libevent-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 'log-internal.h')
-rw-r--r-- | log-internal.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/log-internal.h b/log-internal.h index 3545da9d..d150e209 100644 --- a/log-internal.h +++ b/log-internal.h @@ -37,7 +37,7 @@ #define EV_NORETURN #endif -#define _EVENT_ERR_ABORT 0xdeaddead +#define _EVENT_ERR_ABORT ((int)0xdeaddead) void event_err(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3) EV_NORETURN; void event_warn(const char *fmt, ...) EV_CHECK_FMT(1,2); |