gbranden pushed a commit to branch master
in repository groff.

commit a4fc074b36b2a6054608eb2f7e83d7b5803b8b58
Author: Alejandro Colomar <[email protected]>
AuthorDate: Sat Mar 16 13:35:11 2024 +0100

    [indxbib]: Collapse related tests.
    
    * src/utils/indxbib/indxbib.cpp (check_integer_arg): Collapse related
      tests.
    
    Fixes: d7b36a45fc3f ("[indxbib]: Mitigate Savannah #65452.")
    Link: <https://savannah.gnu.org/bugs/?65452>
    Cc: "G. Branden Robinson" <[email protected]>
    Cc: Dave Kemper <[email protected]>
    Cc: "James K. Lowden" <[email protected]>
    Cc: Colin Watson <[email protected]>
    Cc: Werner LEMBERG <[email protected]>
    Cc: James Clark <[email protected]>
    Signed-off-by: Alejandro Colomar <[email protected]>
---
 ChangeLog                     | 5 +++++
 src/utils/indxbib/indxbib.cpp | 6 +-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a0a821e13..3a47cf9c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-03-16  Alejandro Colomar <[email protected]>
+
+       * src/utils/indxbib/indxbib.cpp (check_integer_arg): Collapse
+       related tests.
+
 2024-03-16  Alejandro Colomar <[email protected]>
 
        * src/utils/indxbib/indxbib.cpp (check_integer_arg): Remove dead
diff --git a/src/utils/indxbib/indxbib.cpp b/src/utils/indxbib/indxbib.cpp
index 68d5756e2..adb951085 100644
--- a/src/utils/indxbib/indxbib.cpp
+++ b/src/utils/indxbib/indxbib.cpp
@@ -340,13 +340,9 @@ static void check_integer_arg(char opt, const char *arg, 
int min, int *res)
   char *ptr;
   errno = 0;
   long n = strtol(arg, &ptr, 10);
-  if (ERANGE == errno)
-    fatal("argument to -%1 must be between %2 and %3", arg, min, INT_MAX);
   if (ptr == arg)
     fatal("argument to -%1 not an integer", opt);
-  if (n < min)
-    fatal("argument to -%1 must not be less than %2", opt, min);
-  if (n > INT_MAX)
+  if (ERANGE == errno || n < min || n > INT_MAX)
     fatal("argument to -%1 must be between %2 and %3", arg, min, INT_MAX);
   if (*ptr != '\0')
     fatal("junk after integer argument to -%1", opt);

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to