]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
Remove redundant code 526/head
authorMarek Küthe <m.k@mk16.de>
Sat, 15 Feb 2025 21:35:41 +0000 (21:35 +0000)
committerMarek Küthe <m.k@mk16.de>
Sat, 15 Feb 2025 21:35:41 +0000 (21:35 +0000)
As @yvs2014 noted in https://github.com/traviscross/mtr/issues/523#issuecomment-2660970185, it is unnecessary to check whether an int is larger than the maximum int value. An int cannot be greater than the maximum int value.

ui/utils.c

index 45dd47a0435f5a2eb68c6ce9443d71169fd878df..8e8c6d8192915f3f7d98299063e68f3fe734b208 100644 (file)
@@ -80,7 +80,7 @@ int strtoint_or_err(
     if (str != NULL && *str != '\0') {
         errno = 0;
         num = strtol(str, &end, 0);
-        if (errno == 0 && str != end && end != NULL && *end == '\0' && num < INT_MAX) {
+        if (errno == 0 && str != end && end != NULL && *end == '\0') {
             return num;
         }
     }
@@ -99,7 +99,7 @@ unsigned long strtoulong_or_err(
     if (str != NULL && *str != '\0') {
         errno = 0;
         num = strtoul(str, &end, 0);
-        if (errno == 0 && str != end && end != NULL && *end == '\0' && num < UINT32_MAX) {
+        if (errno == 0 && str != end && end != NULL && *end == '\0') {
             return num;
         }
     }