diff options
author | Thomas Graf <tgraf@suug.ch> | 2014-08-26 12:08:41 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-08-26 12:12:52 (GMT) |
commit | 7c775184c107b8abd1acd3122c357e0d020376df (patch) | |
tree | fbfc504d0367a25ce06281ea651dc768edf2481c | |
parent | 54f6d7d1b376348a710c482e3f6852ffaa8675c3 (diff) | |
download | libnl-7c775184c107b8abd1acd3122c357e0d020376df.zip libnl-7c775184c107b8abd1acd3122c357e0d020376df.tar.gz libnl-7c775184c107b8abd1acd3122c357e0d020376df.tar.bz2 |
Remove pointless N < 0 checks
route/tc.c:553:9: warning: comparison of unsigned enum expression < 0 is
always false [-Wtautological-compare]
if (id < 0 || id > RTNL_TC_STATS_MAX)
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | lib/handlers.c | 8 | ||||
-rw-r--r-- | lib/route/tc.c | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/handlers.c b/lib/handlers.c index a6a97bb..97a0d9c 100644 --- a/lib/handlers.c +++ b/lib/handlers.c @@ -203,7 +203,7 @@ struct nl_cb *nl_cb_alloc(enum nl_cb_kind kind) int i; struct nl_cb *cb; - if (kind < 0 || kind > NL_CB_KIND_MAX) + if ((unsigned int) kind > NL_CB_KIND_MAX) return NULL; cb = calloc(1, sizeof(*cb)); @@ -293,10 +293,10 @@ enum nl_cb_type nl_cb_active_type(struct nl_cb *cb) int nl_cb_set(struct nl_cb *cb, enum nl_cb_type type, enum nl_cb_kind kind, nl_recvmsg_msg_cb_t func, void *arg) { - if (type < 0 || type > NL_CB_TYPE_MAX) + if ((unsigned int) type > NL_CB_TYPE_MAX) return -NLE_RANGE; - if (kind < 0 || kind > NL_CB_KIND_MAX) + if ((unsigned int) kind > NL_CB_KIND_MAX) return -NLE_RANGE; if (kind == NL_CB_CUSTOM) { @@ -343,7 +343,7 @@ int nl_cb_set_all(struct nl_cb *cb, enum nl_cb_kind kind, int nl_cb_err(struct nl_cb *cb, enum nl_cb_kind kind, nl_recvmsg_err_cb_t func, void *arg) { - if (kind < 0 || kind > NL_CB_KIND_MAX) + if ((unsigned int) kind > NL_CB_KIND_MAX) return -NLE_RANGE; if (kind == NL_CB_CUSTOM) { diff --git a/lib/route/tc.c b/lib/route/tc.c index 34c3b57..53b69d5 100644 --- a/lib/route/tc.c +++ b/lib/route/tc.c @@ -550,7 +550,7 @@ char *rtnl_tc_get_kind(struct rtnl_tc *tc) */ uint64_t rtnl_tc_get_stat(struct rtnl_tc *tc, enum rtnl_tc_stat id) { - if (id < 0 || id > RTNL_TC_STATS_MAX) + if ((unsigned int) id > RTNL_TC_STATS_MAX) return 0; return tc->tc_stats[id]; |