pie: remove always false condition

When built with GCC warnings enabled:
q_pie.c: In function ‘pie_parse_opt’:
q_pie.c:78:38: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
        (alpha > ALPHA_MAX) || (alpha < ALPHA_MIN)) {
                                      ^
q_pie.c:85:35: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
        (beta > BETA_MAX) || (beta < BETA_MIN)) {
                                   ^

This is because MIN is 0 and unsigned number can never be less than 0.
Therefore just remove the _MIN values.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Stephen Hemminger 2017-03-10 08:56:51 -08:00
parent 837552b445
commit 60ccfcd7f2

View File

@ -37,9 +37,7 @@ static void explain(void)
}
#define ALPHA_MAX 32
#define ALPHA_MIN 0
#define BETA_MAX 32
#define BETA_MIN 0
static int pie_parse_opt(struct qdisc_util *qu, int argc, char **argv,
struct nlmsghdr *n)
@ -75,14 +73,14 @@ static int pie_parse_opt(struct qdisc_util *qu, int argc, char **argv,
} else if (strcmp(*argv, "alpha") == 0) {
NEXT_ARG();
if (get_unsigned(&alpha, *argv, 0) ||
(alpha > ALPHA_MAX) || (alpha < ALPHA_MIN)) {
(alpha > ALPHA_MAX)) {
fprintf(stderr, "Illegal \"alpha\"\n");
return -1;
}
} else if (strcmp(*argv, "beta") == 0) {
NEXT_ARG();
if (get_unsigned(&beta, *argv, 0) ||
(beta > BETA_MAX) || (beta < BETA_MIN)) {
(beta > BETA_MAX)) {
fprintf(stderr, "Illegal \"beta\"\n");
return -1;
}