]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
pie: remove always false condition
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 10 Mar 2017 16:56:51 +0000 (08:56 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 10 Mar 2017 16:58:01 +0000 (08:58 -0800)
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>
tc/q_pie.c

index 069a752b82be242d3721a7bb39f33335a66edd06..a697db752daff202d9d2aca4da6da4995c1739c5 100644 (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;
                        }