From 778862f139580768bbb3ec443c81cbb937860a76 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20K=C3=BCthe?= Date: Sat, 15 Feb 2025 21:35:41 +0000 Subject: [PATCH] Remove redundant code 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/utils.c b/ui/utils.c index 45dd47a..8e8c6d8 100644 --- a/ui/utils.c +++ b/ui/utils.c @@ -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; } } -- 2.47.2