]> Savannah Git Hosting - gnulib.git/commitdiff
vasnprintf, vasnwprintf: Simplify code.
authorBruno Haible <bruno@clisp.org>
Fri, 17 Mar 2023 21:33:24 +0000 (22:33 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 17 Mar 2023 21:33:24 +0000 (22:33 +0100)
* lib/vasnprintf.c (MAX_ROOM_NEEDED): Remove dead code: The directives
'o', 'x', 'X' always take an unsigned integer argument.

ChangeLog
lib/vasnprintf.c

index 8318d7f6fcb660aecbb11d337106e76051ae0cc1..62dd39e17f1367b012997ba963faf40dd00dd852 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-03-17  Bruno Haible  <bruno@clisp.org>
+
+       vasnprintf, vasnwprintf: Simplify code.
+       * lib/vasnprintf.c (MAX_ROOM_NEEDED): Remove dead code: The directives
+       'o', 'x', 'X' always take an unsigned integer argument.
+
 2023-03-17  Bruno Haible  <bruno@clisp.org>
 
        vasnwprintf: Fix test failure on OpenBSD.
index 74a6712926af2392744487024f90a425cd8e84ed..a49eb1dcd7a83046e5612396cff91d139bc9c6c4 100644 (file)
@@ -1654,13 +1654,13 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
       break;
 
     case 'o':
-      if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
+      if (type == TYPE_ULONGLONGINT)
         tmp_length =
           (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
                           * 0.333334 /* binary -> octal */
                          )
           + 1; /* turn floor into ceil */
-      else if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
+      else if (type == TYPE_ULONGINT)
         tmp_length =
           (unsigned int) (sizeof (unsigned long) * CHAR_BIT
                           * 0.333334 /* binary -> octal */
@@ -1679,13 +1679,13 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
       break;
 
     case 'x': case 'X':
-      if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
+      if (type == TYPE_ULONGLONGINT)
         tmp_length =
           (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
                           * 0.25 /* binary -> hexadecimal */
                          )
           + 1; /* turn floor into ceil */
-      else if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
+      else if (type == TYPE_ULONGINT)
         tmp_length =
           (unsigned int) (sizeof (unsigned long) * CHAR_BIT
                           * 0.25 /* binary -> hexadecimal */
@@ -1699,7 +1699,7 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
           + 1; /* turn floor into ceil */
       if (tmp_length < precision)
         tmp_length = precision;
-      /* Add 2, to account for a leading sign or alternate form.  */
+      /* Add 2, to account for a prefix from the alternate form.  */
       tmp_length = xsum (tmp_length, 2);
       break;