]> granicus.if.org Git - procps-ng/commitdiff
free: remove redundant boundary check
authorSami Kerola <kerolasa@iki.fi>
Sun, 26 Feb 2012 11:26:59 +0000 (12:26 +0100)
committerCraig Small <csmall@enc.com.au>
Sat, 3 Mar 2012 07:36:29 +0000 (18:36 +1100)
The strtol_or_err() already check argument is not larger than
LONG_MAX. This commit also removes clang warning.

free.c:262:55: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
                        if (args.repeat_counter < 1 || args.repeat_counter > ULONG_MAX/2)
                                                       ~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
free.c

diff --git a/free.c b/free.c
index 54825ab002378708eb1e0d8e46219d1ce0d4a94b..5a618d3293c768a377a4031f0d69aea523a0ad5c 100644 (file)
--- a/free.c
+++ b/free.c
@@ -259,7 +259,7 @@ int main(int argc, char **argv)
                        flags |= FREE_REPEATCOUNT;
                        args.repeat_counter = strtol_or_err(optarg,
                                _("failed to parse count argument"));
-                       if (args.repeat_counter < 1 || args.repeat_counter > ULONG_MAX/2)
+                       if (args.repeat_counter < 1)
                          error(EXIT_FAILURE, ERANGE,
                                  _("failed to parse count argument: '%s'"), optarg);
                        break;