]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Refactor: Use more of c-ctype.h.
authorBruno Haible <bruno@clisp.org>
Sun, 23 Mar 2025 19:17:56 +0000 (20:17 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 23 Mar 2025 19:17:56 +0000 (20:17 +0100)
* gettext-tools/src/format-awk.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.
* gettext-tools/src/format-boost.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.
* gettext-tools/src/format-c-parse.h (isdigit): Remove macro.
(format_parse_entrails): Use c_isdigit instead.
* gettext-tools/src/format-c++-brace.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.
* gettext-tools/src/format-elisp.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.
* gettext-tools/src/format-gcc-internal.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.
* gettext-tools/src/format-gfc-internal.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.
* gettext-tools/src/format-go.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.
* gettext-tools/src/format-java-printf.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.
* gettext-tools/src/format-javascript.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.
* gettext-tools/src/format-librep.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.
* gettext-tools/src/format-lua.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.
* gettext-tools/src/format-pascal.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.
* gettext-tools/src/format-perl.c (isdigit): Remove macro.
(c_isnonzerodigit): Renamed from isnonzerodigit.
(format_parse): Use c_isdigit instead of isdigit.
* gettext-tools/src/format-php.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.
* gettext-tools/src/format-python.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.
* gettext-tools/src/format-ruby.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.
* gettext-tools/src/format-tcl.c (isdigit): Remove macro.
(format_parse): Use c_isdigit instead.

18 files changed:
gettext-tools/src/format-awk.c
gettext-tools/src/format-boost.c
gettext-tools/src/format-c++-brace.c
gettext-tools/src/format-c-parse.h
gettext-tools/src/format-elisp.c
gettext-tools/src/format-gcc-internal.c
gettext-tools/src/format-gfc-internal.c
gettext-tools/src/format-go.c
gettext-tools/src/format-java-printf.c
gettext-tools/src/format-javascript.c
gettext-tools/src/format-librep.c
gettext-tools/src/format-lua.c
gettext-tools/src/format-pascal.c
gettext-tools/src/format-perl.c
gettext-tools/src/format-php.c
gettext-tools/src/format-python.c
gettext-tools/src/format-ruby.c
gettext-tools/src/format-tcl.c

index 57b5bcb35bccc919a78e914baa2cc57ea6ca44cc..bdacf3eeab26481537fce0dda75f6c957da4325b 100644 (file)
@@ -1,5 +1,5 @@
 /* awk format strings.
-   Copyright (C) 2001-2004, 2006-2007, 2009, 2019-2020, 2023 Free Software Foundation, Inc.
+   Copyright (C) 2001-2025 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2002.
 
    This program is free software: you can redistribute it and/or modify
@@ -75,12 +75,6 @@ struct spec
   struct numbered_arg *numbered;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 
 static int
 numbered_arg_compare (const void *p1, const void *p2)
@@ -118,7 +112,7 @@ format_parse (const char *format, bool translated, char *fdi,
         FDI_SET (format - 1, FMTDIR_START);
         spec.directives++;
 
-        if (isdigit (*format))
+        if (c_isdigit (*format))
           {
             const char *f = format;
             unsigned int m = 0;
@@ -128,7 +122,7 @@ format_parse (const char *format, bool translated, char *fdi,
                 m = 10 * m + (*f - '0');
                 f++;
               }
-            while (isdigit (*f));
+            while (c_isdigit (*f));
 
             if (*f == '$')
               {
@@ -155,7 +149,7 @@ format_parse (const char *format, bool translated, char *fdi,
 
             format++;
 
-            if (isdigit (*format))
+            if (c_isdigit (*format))
               {
                 const char *f = format;
                 unsigned int m = 0;
@@ -165,7 +159,7 @@ format_parse (const char *format, bool translated, char *fdi,
                     m = 10 * m + (*f - '0');
                     f++;
                   }
-                while (isdigit (*f));
+                while (c_isdigit (*f));
 
                 if (*f == '$')
                   {
@@ -224,9 +218,9 @@ format_parse (const char *format, bool translated, char *fdi,
                 unnumbered_arg_count++;
               }
           }
-        else if (isdigit (*format))
+        else if (c_isdigit (*format))
           {
-            do format++; while (isdigit (*format));
+            do format++; while (c_isdigit (*format));
           }
 
         /* Parse precision.  */
@@ -240,7 +234,7 @@ format_parse (const char *format, bool translated, char *fdi,
 
                 format++;
 
-                if (isdigit (*format))
+                if (c_isdigit (*format))
                   {
                     const char *f = format;
                     unsigned int m = 0;
@@ -250,7 +244,7 @@ format_parse (const char *format, bool translated, char *fdi,
                         m = 10 * m + (*f - '0');
                         f++;
                       }
-                    while (isdigit (*f));
+                    while (c_isdigit (*f));
 
                     if (*f == '$')
                       {
@@ -309,9 +303,9 @@ format_parse (const char *format, bool translated, char *fdi,
                     unnumbered_arg_count++;
                   }
               }
-            else if (isdigit (*format))
+            else if (c_isdigit (*format))
               {
-                do format++; while (isdigit (*format));
+                do format++; while (c_isdigit (*format));
               }
           }
 
index c191ff1b36dd22a1e85335937ebc76fe9c053c0d..eb7e2ece2c729eef253e0c3bebc75633f9082621 100644 (file)
@@ -1,5 +1,5 @@
 /* Boost format strings.
-   Copyright (C) 2001-2004, 2006-2007, 2009, 2019-2020, 2023 Free Software Foundation, Inc.
+   Copyright (C) 2001-2025 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
@@ -96,12 +96,6 @@ struct spec
   struct numbered_arg *numbered;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 
 static int
 numbered_arg_compare (const void *p1, const void *p2)
@@ -151,7 +145,7 @@ format_parse (const char *format, bool translated, char *fdi,
                 brackets = true;
               }
 
-            if (isdigit (*format) && *format != '0')
+            if (c_isdigit (*format) && *format != '0')
               {
                 const char *f = format;
                 unsigned int m = 0;
@@ -161,7 +155,7 @@ format_parse (const char *format, bool translated, char *fdi,
                     m = 10 * m + (*f - '0');
                     f++;
                   }
-                while (isdigit (*f));
+                while (c_isdigit (*f));
 
                 if ((!brackets && *f == '%') || *f == '$')
                   {
@@ -202,7 +196,7 @@ format_parse (const char *format, bool translated, char *fdi,
 
                     format++;
 
-                    if (isdigit (*format))
+                    if (c_isdigit (*format))
                       {
                         const char *f = format;
                         unsigned int m = 0;
@@ -212,7 +206,7 @@ format_parse (const char *format, bool translated, char *fdi,
                             m = 10 * m + (*f - '0');
                             f++;
                           }
-                        while (isdigit (*f));
+                        while (c_isdigit (*f));
 
                         if (*f == '$')
                           {
@@ -275,9 +269,9 @@ format_parse (const char *format, bool translated, char *fdi,
                         unnumbered_arg_count++;
                       }
                   }
-                else if (isdigit (*format))
+                else if (c_isdigit (*format))
                   {
-                    do format++; while (isdigit (*format));
+                    do format++; while (c_isdigit (*format));
                   }
 
                 /* Parse precision.  */
@@ -291,7 +285,7 @@ format_parse (const char *format, bool translated, char *fdi,
 
                         format++;
 
-                        if (isdigit (*format))
+                        if (c_isdigit (*format))
                           {
                             const char *f = format;
                             unsigned int m = 0;
@@ -301,7 +295,7 @@ format_parse (const char *format, bool translated, char *fdi,
                                 m = 10 * m + (*f - '0');
                                 f++;
                               }
-                            while (isdigit (*f));
+                            while (c_isdigit (*f));
 
                             if (*f == '$')
                               {
@@ -364,9 +358,9 @@ format_parse (const char *format, bool translated, char *fdi,
                             unnumbered_arg_count++;
                           }
                       }
-                    else if (isdigit (*format))
+                    else if (c_isdigit (*format))
                       {
-                        do format++; while (isdigit (*format));
+                        do format++; while (c_isdigit (*format));
                       }
                   }
 
index 33fa027fef6a47ab013c086dbfe3af2a0f7bfad3..28968af185067970e420ba2274cdba6ed49f75b9 100644 (file)
@@ -1,5 +1,5 @@
 /* C++ format strings.
-   Copyright (C) 2003-2023 Free Software Foundation, Inc.
+   Copyright (C) 2003-2025 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2023.
 
    This program is free software: you can redistribute it and/or modify
@@ -195,12 +195,6 @@ struct spec
   struct numbered_arg *numbered;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 
 static int
 numbered_arg_compare (const void *p1, const void *p2)
@@ -251,7 +245,7 @@ format_parse (const char *format, bool translated, char *fdi,
             unsigned int presentation;
 
             /* Parse arg-id.  */
-            if (isdigit (*format))
+            if (c_isdigit (*format))
               {
                 /* Numbered argument.  */
                 unsigned int arg_id;
@@ -262,7 +256,7 @@ format_parse (const char *format, bool translated, char *fdi,
                 else
                   {
                     format++;
-                    while (isdigit (*format))
+                    while (c_isdigit (*format))
                       {
                         if (arg_id >= UINT_MAX / 10)
                           {
@@ -355,16 +349,16 @@ format_parse (const char *format, bool translated, char *fdi,
                   }
 
                 /* Parse width.  */
-                if (isdigit (*format) && *format != '0')
+                if (c_isdigit (*format) && *format != '0')
                   {
                     do
                       format++;
-                    while (isdigit (*format));
+                    while (c_isdigit (*format));
                   }
                 else if (*format == '{')
                   {
                     format++;
-                    if (isdigit (*format))
+                    if (c_isdigit (*format))
                       {
                         /* Numbered argument.  */
                         unsigned int width_arg_id;
@@ -375,7 +369,7 @@ format_parse (const char *format, bool translated, char *fdi,
                         else
                           {
                             format++;
-                            while (isdigit (*format))
+                            while (c_isdigit (*format))
                               {
                                 if (width_arg_id >= UINT_MAX / 10)
                                   {
@@ -447,18 +441,18 @@ format_parse (const char *format, bool translated, char *fdi,
                   {
                     format++;
 
-                    if (isdigit (*format))
+                    if (c_isdigit (*format))
                       {
                         do
                           format++;
-                        while (isdigit (*format));
+                        while (c_isdigit (*format));
 
                         have_precision = true;
                       }
                     else if (*format == '{')
                       {
                         format++;
-                        if (isdigit (*format))
+                        if (c_isdigit (*format))
                           {
                             /* Numbered argument.  */
                             unsigned int precision_arg_id;
@@ -469,7 +463,7 @@ format_parse (const char *format, bool translated, char *fdi,
                             else
                               {
                                 format++;
-                                while (isdigit (*format))
+                                while (c_isdigit (*format))
                                   {
                                     if (precision_arg_id >= UINT_MAX / 10)
                                       {
index 42d2e1d2912f473f89ddafc23337ff82967c8c68..0b52d4081c1c1e1f8354d611fff8932d1ea793ea 100644 (file)
@@ -1,5 +1,5 @@
 /* Parsing C format strings.
-   Copyright (C) 2001-2004, 2006-2007, 2009-2010, 2018, 2020, 2022-2023 Free Software Foundation, Inc.
+   Copyright (C) 2001-2025 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software: you can redistribute it and/or modify
@@ -149,12 +149,6 @@ struct spec
   const char **sysdep_directives;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 /* Whether to recognize the 'I' flag.  */
 #if SYSDEP_SEGMENTS_PROCESSED
 /* The 'I' flag can only occur in glibc >= 2.2.  On other platforms, gettext()
@@ -212,7 +206,7 @@ format_parse_entrails (const char *format, bool translated,
         FDI_SET (format - 1, FMTDIR_START);
         spec.directives++;
 
-        if (isdigit (*format))
+        if (c_isdigit (*format))
           {
             const char *f = format;
             unsigned int m = 0;
@@ -222,7 +216,7 @@ format_parse_entrails (const char *format, bool translated,
                 m = 10 * m + (*f - '0');
                 f++;
               }
-            while (isdigit (*f));
+            while (c_isdigit (*f));
 
             if (*f == '$')
               {
@@ -269,7 +263,7 @@ format_parse_entrails (const char *format, bool translated,
 
             format++;
 
-            if (isdigit (*format))
+            if (c_isdigit (*format))
               {
                 const char *f = format;
                 unsigned int m = 0;
@@ -279,7 +273,7 @@ format_parse_entrails (const char *format, bool translated,
                     m = 10 * m + (*f - '0');
                     f++;
                   }
-                while (isdigit (*f));
+                while (c_isdigit (*f));
 
                 if (*f == '$')
                   {
@@ -339,9 +333,9 @@ format_parse_entrails (const char *format, bool translated,
                 spec.unnumbered_arg_count++;
               }
           }
-        else if (isdigit (*format))
+        else if (c_isdigit (*format))
           {
-            do format++; while (isdigit (*format));
+            do format++; while (c_isdigit (*format));
           }
 
         /* Parse precision.  */
@@ -355,7 +349,7 @@ format_parse_entrails (const char *format, bool translated,
 
                 format++;
 
-                if (isdigit (*format))
+                if (c_isdigit (*format))
                   {
                     const char *f = format;
                     unsigned int m = 0;
@@ -365,7 +359,7 @@ format_parse_entrails (const char *format, bool translated,
                         m = 10 * m + (*f - '0');
                         f++;
                       }
-                    while (isdigit (*f));
+                    while (c_isdigit (*f));
 
                     if (*f == '$')
                       {
@@ -425,9 +419,9 @@ format_parse_entrails (const char *format, bool translated,
                     spec.unnumbered_arg_count++;
                   }
               }
-            else if (isdigit (*format))
+            else if (c_isdigit (*format))
               {
-                do format++; while (isdigit (*format));
+                do format++; while (c_isdigit (*format));
               }
           }
 
index d041cd3b337599675f53efdba6a3773511858d7a..438d7c6aaccd0e4c21b3d65a55df7839aa551584 100644 (file)
@@ -1,5 +1,5 @@
 /* Emacs Lisp format strings.
-   Copyright (C) 2001-2023 Free Software Foundation, Inc.
+   Copyright (C) 2001-2025 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2002.
 
    This program is free software: you can redistribute it and/or modify
@@ -76,12 +76,6 @@ struct spec
   struct numbered_arg *numbered;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 
 static int
 numbered_arg_compare (const void *p1, const void *p2)
@@ -117,7 +111,7 @@ format_parse (const char *format, bool translated, char *fdi,
         FDI_SET (format - 1, FMTDIR_START);
         spec.directives++;
 
-        if (isdigit (*format))
+        if (c_isdigit (*format))
           {
             const char *f = format;
             unsigned int m = 0;
@@ -127,7 +121,7 @@ format_parse (const char *format, bool translated, char *fdi,
                 m = 10 * m + (*f - '0');
                 f++;
               }
-            while (isdigit (*f));
+            while (c_isdigit (*f));
 
             if (*f == '$' && m > 0)
               {
@@ -157,9 +151,9 @@ format_parse (const char *format, bool translated, char *fdi,
 
             number++;
           }
-        else if (isdigit (*format))
+        else if (c_isdigit (*format))
           {
-            do format++; while (isdigit (*format));
+            do format++; while (c_isdigit (*format));
           }
 
         /* Parse precision.  */
@@ -182,9 +176,9 @@ format_parse (const char *format, bool translated, char *fdi,
 
                 number++;
               }
-            else if (isdigit (*format))
+            else if (c_isdigit (*format))
               {
-                do format++; while (isdigit (*format));
+                do format++; while (c_isdigit (*format));
               }
           }
 
index ce5ea66dd277faadb93ebba76b5edd00b3a76dfd..4e7335b1ea27918f948c6c1008b827bed56098e9 100644 (file)
@@ -1,5 +1,5 @@
 /* GCC internal format strings.
-   Copyright (C) 2003-2009, 2019-2020, 2023 Free Software Foundation, Inc.
+   Copyright (C) 2003-2025 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software: you can redistribute it and/or modify
@@ -140,12 +140,6 @@ struct spec
   bool uses_err_no;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 
 static int
 numbered_arg_compare (const void *p1, const void *p2)
@@ -197,7 +191,7 @@ format_parse (const char *format, bool translated, char *fdi,
             format_arg_type_t size;
             format_arg_type_t type;
 
-            if (isdigit (*format))
+            if (c_isdigit (*format))
               {
                 const char *f = format;
                 unsigned int m = 0;
@@ -207,7 +201,7 @@ format_parse (const char *format, bool translated, char *fdi,
                     m = 10 * m + (*f - '0');
                     f++;
                   }
-                while (isdigit (*f));
+                while (c_isdigit (*f));
 
                 if (*f == '$')
                   {
@@ -274,11 +268,11 @@ format_parse (const char *format, bool translated, char *fdi,
               {
                 format++;
 
-                if (isdigit (*format))
+                if (c_isdigit (*format))
                   {
                     do
                       format++;
-                    while (isdigit (*format));
+                    while (c_isdigit (*format));
 
                     if (*format != 's')
                       {
@@ -304,7 +298,7 @@ format_parse (const char *format, bool translated, char *fdi,
 
                     format++;
 
-                    if (isdigit (*format))
+                    if (c_isdigit (*format))
                       {
                         const char *f = format;
                         unsigned int m = 0;
@@ -314,7 +308,7 @@ format_parse (const char *format, bool translated, char *fdi,
                             m = 10 * m + (*f - '0');
                             f++;
                           }
-                        while (isdigit (*f));
+                        while (c_isdigit (*f));
 
                         if (*f == '$')
                           {
index 04a9b6d8b19d4d668e6a13303483930a42c5d224..ebb1ab7a4ce1de747111ffaa71ffa596236068f4 100644 (file)
@@ -1,5 +1,5 @@
 /* GFC (GNU Fortran Compiler) internal format strings.
-   Copyright (C) 2003-2023 Free Software Foundation, Inc.
+   Copyright (C) 2003-2025 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2009.
 
    This program is free software: you can redistribute it and/or modify
@@ -100,12 +100,6 @@ struct spec
   bool uses_currentloc;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 
 static int
 numbered_arg_compare (const void *p1, const void *p2)
@@ -146,7 +140,7 @@ format_parse (const char *format, bool translated, char *fdi,
           {
             format_arg_type_t type;
 
-            if (isdigit (*format))
+            if (c_isdigit (*format))
               {
                 const char *f = format;
                 unsigned int m = 0;
@@ -156,7 +150,7 @@ format_parse (const char *format, bool translated, char *fdi,
                     m = 10 * m + (*f - '0');
                     f++;
                   }
-                while (isdigit (*f));
+                while (c_isdigit (*f));
 
                 if (*f == '$')
                   {
index ae651afa41e5f58aa3d35a9f8fe947dc9f1bb372..259a3b397758cae31cba26c436170ca70a8c0135 100644 (file)
@@ -97,12 +97,6 @@ struct spec
   struct numbered_arg *numbered;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 
 static int
 numbered_arg_compare (const void *p1, const void *p2)
@@ -148,7 +142,7 @@ format_parse (const char *format, bool translated, char *fdi,
 
         if (*format == '[')
           {
-            if (isdigit (format[1]))
+            if (c_isdigit (format[1]))
               {
                 const char *f = format + 1;
                 unsigned int m = 0;
@@ -159,7 +153,7 @@ format_parse (const char *format, bool translated, char *fdi,
                       m = 10 * m + (*f - '0');
                     f++;
                   }
-                while (isdigit (*f));
+                while (c_isdigit (*f));
 
                 if (*f == ']')
                   {
@@ -203,7 +197,7 @@ format_parse (const char *format, bool translated, char *fdi,
           }
 
         /* Parse width other than [m]*.  */
-        if (isdigit (*format))
+        if (c_isdigit (*format))
           {
             const char *f = format;
             unsigned int width = 0;
@@ -214,7 +208,7 @@ format_parse (const char *format, bool translated, char *fdi,
                   width = 10 * width + (*f - '0');
                 f++;
               }
-            while (isdigit (*f));
+            while (c_isdigit (*f));
 
             if (width > 1000000)
               {
@@ -249,7 +243,7 @@ format_parse (const char *format, bool translated, char *fdi,
           {
             if (format[1] == '[')
               {
-                if (isdigit (format[2]))
+                if (c_isdigit (format[2]))
                   {
                     const char *f = format + 2;
                     unsigned int m = 0;
@@ -260,7 +254,7 @@ format_parse (const char *format, bool translated, char *fdi,
                           m = 10 * m + (*f - '0');
                         f++;
                       }
-                    while (isdigit (*f));
+                    while (c_isdigit (*f));
 
                     if (*f == ']')
                       {
@@ -307,7 +301,7 @@ format_parse (const char *format, bool translated, char *fdi,
               }
 
             /* Parse precision other than [m]*.  */
-            if (isdigit (format[1]))
+            if (c_isdigit (format[1]))
               {
                 const char *f = format + 1;
                 unsigned int precision = 0;
@@ -318,7 +312,7 @@ format_parse (const char *format, bool translated, char *fdi,
                       precision = 10 * precision + (*f - '0');
                     f++;
                   }
-                while (isdigit (*f));
+                while (c_isdigit (*f));
 
                 if (precision > 1000000)
                   {
@@ -351,7 +345,7 @@ format_parse (const char *format, bool translated, char *fdi,
        parse_value:
         if (*format == '[')
           {
-            if (isdigit (format[1]))
+            if (c_isdigit (format[1]))
               {
                 const char *f = format + 1;
                 unsigned int m = 0;
@@ -362,7 +356,7 @@ format_parse (const char *format, bool translated, char *fdi,
                       m = 10 * m + (*f - '0');
                     f++;
                   }
-                while (isdigit (*f));
+                while (c_isdigit (*f));
 
                 if (*f == ']')
                   {
index 1e76fd624faa95841b40a4bd1b1433c5826bc9cd..82283cd6957a079f949a969dc71d6c8860663bca 100644 (file)
@@ -1,5 +1,5 @@
 /* Java printf format strings.
-   Copyright (C) 2001-2004, 2006-2007, 2009-2010, 2018-2020, 2023 Free Software Foundation, Inc.
+   Copyright (C) 2001-2025 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software: you can redistribute it and/or modify
@@ -118,12 +118,6 @@ struct spec
   struct numbered_arg *numbered;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 
 static int
 numbered_arg_compare (const void *p1, const void *p2)
@@ -195,7 +189,7 @@ format_parse (const char *format, bool translated, char *fdi,
             number = last_arg_number;
             format++;
           }
-        else if (isdigit (*format))
+        else if (c_isdigit (*format))
           {
             const char *f = format;
             unsigned int m = 0;
@@ -205,7 +199,7 @@ format_parse (const char *format, bool translated, char *fdi,
                 m = 10 * m + (*f - '0');
                 f++;
               }
-            while (isdigit (*f));
+            while (c_isdigit (*f));
 
             if (*f == '$')
               {
@@ -265,9 +259,9 @@ format_parse (const char *format, bool translated, char *fdi,
           }
 
         /* Parse width.  */
-        if (isdigit (*format))
+        if (c_isdigit (*format))
           {
-            do format++; while (isdigit (*format));
+            do format++; while (c_isdigit (*format));
             flags |= FAT_WIDTH;
           }
 
@@ -276,7 +270,7 @@ format_parse (const char *format, bool translated, char *fdi,
           {
             format++;
 
-            if (!isdigit (*format))
+            if (!c_isdigit (*format))
               {
                 if (*format == '\0')
                   {
@@ -291,7 +285,7 @@ format_parse (const char *format, bool translated, char *fdi,
                 goto bad_format;
               }
 
-            do format++; while (isdigit (*format));
+            do format++; while (c_isdigit (*format));
             flags |= FAT_PRECISION;
           }
 
index 79d87e1ae2c878abd38c56dfdf8bb44733ceb27c..810a98ce2771dca03bf6630dab5961a9238641bc 100644 (file)
@@ -1,5 +1,5 @@
 /* JavaScript format strings.
-   Copyright (C) 2001-2004, 2006-2010, 2013, 2016, 2019-2020, 2023 Free Software Foundation, Inc.
+   Copyright (C) 2001-2025 Free Software Foundation, Inc.
    Written by Andreas Stricker <andy@knitter.ch>, 2010.
    It's based on python format module from Bruno Haible.
 
@@ -77,12 +77,6 @@ struct spec
   struct numbered_arg *numbered;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 
 static int
 numbered_arg_compare (const void *p1, const void *p2)
@@ -120,7 +114,7 @@ format_parse (const char *format, bool translated, char *fdi,
         FDI_SET (format - 1, FMTDIR_START);
         spec.directives++;
 
-        if (isdigit (*format))
+        if (c_isdigit (*format))
           {
             const char *f = format;
             unsigned int m = 0;
@@ -130,7 +124,7 @@ format_parse (const char *format, bool translated, char *fdi,
                 m = 10 * m + (*f - '0');
                 f++;
               }
-            while (isdigit (*f));
+            while (c_isdigit (*f));
 
             if (*f == '$')
               {
@@ -151,14 +145,14 @@ format_parse (const char *format, bool translated, char *fdi,
           format++;
 
         /* Parse width.  */
-        while (isdigit (*format))
+        while (c_isdigit (*format))
           format++;
 
         if (*format == '.')
           {
             format++;
 
-            while (isdigit (*format))
+            while (c_isdigit (*format))
               format++;
           }
 
index 66824c1749554c972ae7585a2dfcfc978850db9c..3d266e3f5fc13e7bc8991c79ccad2a5dd830ad41 100644 (file)
@@ -1,5 +1,5 @@
 /* librep format strings.
-   Copyright (C) 2001-2004, 2006-2007, 2009, 2019-2020, 2023 Free Software Foundation, Inc.
+   Copyright (C) 2001-2025 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software: you can redistribute it and/or modify
@@ -73,12 +73,6 @@ struct spec
   struct numbered_arg *numbered;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 
 static int
 numbered_arg_compare (const void *p1, const void *p2)
@@ -114,7 +108,7 @@ format_parse (const char *format, bool translated, char *fdi,
         FDI_SET (format - 1, FMTDIR_START);
         spec.directives++;
 
-        if (isdigit (*format))
+        if (c_isdigit (*format))
           {
             const char *f = format;
             unsigned int m = 0;
@@ -124,7 +118,7 @@ format_parse (const char *format, bool translated, char *fdi,
                 m = 10 * m + (*f - '0');
                 f++;
               }
-            while (isdigit (*f));
+            while (c_isdigit (*f));
 
             if (*f == '$' && m > 0)
               {
@@ -139,9 +133,9 @@ format_parse (const char *format, bool translated, char *fdi,
           format++;
 
         /* Parse width.  */
-        if (isdigit (*format))
+        if (c_isdigit (*format))
           {
-            do format++; while (isdigit (*format));
+            do format++; while (c_isdigit (*format));
           }
 
         /* Parse precision.  */
@@ -149,9 +143,9 @@ format_parse (const char *format, bool translated, char *fdi,
           {
             format++;
 
-            if (isdigit (*format))
+            if (c_isdigit (*format))
               {
-                do format++; while (isdigit (*format));
+                do format++; while (c_isdigit (*format));
               }
           }
 
index 98a9b20ea026c3c8889db433450ed8648903756f..1f0b8920f9ec9de87aaa867557b6129ad48bccb5 100644 (file)
@@ -1,5 +1,5 @@
 /* Lua format strings.
-   Copyright (C) 2012-2023 Free Software Foundation, Inc.
+   Copyright (C) 2012-2025 Free Software Foundation, Inc.
    Written by Ä½ubomír Remák <lubomirr@lubomirr.eu>, 2012.
 
    This program is free software: you can redistribute it and/or modify
@@ -72,12 +72,6 @@ struct spec
   enum format_arg_type *format_args;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 static void format_free (void *descr);
 
 static void *
@@ -108,7 +102,7 @@ format_parse (const char *format, bool translated, char *fdi,
               enum format_arg_type type;
 
               /* Remove width. */
-              while (isdigit (*fatstr))
+              while (c_isdigit (*fatstr))
                 fatstr++;
 
               if (*fatstr == '.')
@@ -116,7 +110,7 @@ format_parse (const char *format, bool translated, char *fdi,
                   fatstr++;
 
                   /* Remove precision. */
-                  while (isdigit (*fatstr))
+                  while (c_isdigit (*fatstr))
                     fatstr++;
                 }
 
index 07b0021a41bb11b954911cee12a1bae6c0c0af43..855acc614d691c84b17940b6f8e3d8b555dcf897 100644 (file)
@@ -1,5 +1,5 @@
 /* Object Pascal format strings.
-   Copyright (C) 2001-2004, 2006-2007, 2009-2010, 2018-2020, 2023 Free Software Foundation, Inc.
+   Copyright (C) 2001-2025 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software: you can redistribute it and/or modify
@@ -87,12 +87,6 @@ struct spec
   struct numbered_arg *numbered;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 
 static int
 numbered_arg_compare (const void *p1, const void *p2)
@@ -142,12 +136,12 @@ format_parse (const char *format, bool translated, char *fdi,
             unsigned int main_number = 0;
             enum format_arg_type type;
 
-            if (isdigit (*format) || *format == ':')
+            if (c_isdigit (*format) || *format == ':')
               {
                 const char *f = format;
                 unsigned int m = 0;
 
-                while (isdigit (*f))
+                while (c_isdigit (*f))
                   {
                     m = 10 * m + (*f - '0');
                     f++;
@@ -174,11 +168,11 @@ format_parse (const char *format, bool translated, char *fdi,
               format++;
 
             /* Parse width.  */
-            if (isdigit (*format))
+            if (c_isdigit (*format))
               {
                 do
                   format++;
-                while (isdigit (*format));
+                while (c_isdigit (*format));
               }
             else if (*format == '*')
               {
@@ -201,11 +195,11 @@ format_parse (const char *format, bool translated, char *fdi,
               {
                 format++;
 
-                if (isdigit (*format))
+                if (c_isdigit (*format))
                   {
                     do
                       format++;
-                    while (isdigit (*format));
+                    while (c_isdigit (*format));
                   }
                 else if (*format == '*')
                   {
index 3e2d917aff9f1d99f4d371c6ea05356dbeb049e0..6ffa05100ab76be4e502aa9e8444abe865013f70 100644 (file)
@@ -1,5 +1,5 @@
 /* Perl format strings.
-   Copyright (C) 2004, 2006-2007, 2009, 2019-2020, 2023 Free Software Foundation, Inc.
+   Copyright (C) 2004-2025 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software: you can redistribute it and/or modify
@@ -112,14 +112,8 @@ struct spec
   struct numbered_arg *numbered;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 /* Locale independent test for a nonzero decimal digit.  */
-#define isnonzerodigit(c) ((unsigned int) ((c) - '1') < 9)
+#define c_isnonzerodigit(c) ((unsigned int) ((c) - '1') < 9)
 
 
 static int
@@ -161,7 +155,7 @@ format_parse (const char *format, bool translated, char *fdi,
         FDI_SET (format - 1, FMTDIR_START);
         directives++;
 
-        if (isnonzerodigit (*format))
+        if (c_isnonzerodigit (*format))
           {
             const char *f = format;
             unsigned int m = 0;
@@ -171,7 +165,7 @@ format_parse (const char *format, bool translated, char *fdi,
                 m = 10 * m + (*f - '0');
                 f++;
               }
-            while (isdigit (*f));
+            while (c_isdigit (*f));
 
             if (*f == '$')
               {
@@ -211,7 +205,7 @@ format_parse (const char *format, bool translated, char *fdi,
                 numbered[numbered_arg_count].type = FAT_SCALAR_VECTOR; /* or FAT_STRING? */
                 numbered_arg_count++;
               }
-            else if (isnonzerodigit (*f))
+            else if (c_isnonzerodigit (*f))
               {
                 unsigned int m = 0;
 
@@ -220,7 +214,7 @@ format_parse (const char *format, bool translated, char *fdi,
                     m = 10 * m + (*f - '0');
                     f++;
                   }
-                while (isdigit (*f));
+                while (c_isdigit (*f));
 
                 if (*f == '$')
                   {
@@ -268,7 +262,7 @@ format_parse (const char *format, bool translated, char *fdi,
 
             format++;
 
-            if (isnonzerodigit (*format))
+            if (c_isnonzerodigit (*format))
               {
                 const char *f = format;
                 unsigned int m = 0;
@@ -278,7 +272,7 @@ format_parse (const char *format, bool translated, char *fdi,
                     m = 10 * m + (*f - '0');
                     f++;
                   }
-                while (isdigit (*f));
+                while (c_isdigit (*f));
 
                 if (*f == '$')
                   {
@@ -299,9 +293,9 @@ format_parse (const char *format, bool translated, char *fdi,
             numbered[numbered_arg_count].type = FAT_INTEGER;
             numbered_arg_count++;
           }
-        else if (isnonzerodigit (*format))
+        else if (c_isnonzerodigit (*format))
           {
-            do format++; while (isdigit (*format));
+            do format++; while (c_isdigit (*format));
           }
 
         /* Parse precision.  */
@@ -315,7 +309,7 @@ format_parse (const char *format, bool translated, char *fdi,
 
                 format++;
 
-                if (isnonzerodigit (*format))
+                if (c_isnonzerodigit (*format))
                   {
                     const char *f = format;
                     unsigned int m = 0;
@@ -325,7 +319,7 @@ format_parse (const char *format, bool translated, char *fdi,
                         m = 10 * m + (*f - '0');
                         f++;
                       }
-                    while (isdigit (*f));
+                    while (c_isdigit (*f));
 
                     if (*f == '$')
                       {
@@ -346,7 +340,7 @@ format_parse (const char *format, bool translated, char *fdi,
               }
             else
               {
-                while (isdigit (*format)) format++;
+                while (c_isdigit (*format)) format++;
               }
           }
 
index 8d941401d5e8b5adf9d03b29e1089cf084e9755c..b43fd5a995c7011d667036c1a0446a8741932151 100644 (file)
@@ -1,5 +1,5 @@
 /* PHP format strings.
-   Copyright (C) 2001-2024 Free Software Foundation, Inc.
+   Copyright (C) 2001-2025 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software: you can redistribute it and/or modify
@@ -76,12 +76,6 @@ struct spec
   struct numbered_arg *numbered;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 
 static int
 numbered_arg_compare (const void *p1, const void *p2)
@@ -124,7 +118,7 @@ format_parse (const char *format, bool translated, char *fdi,
             enum format_arg_type type;
 
             number = ++unnumbered_arg_count;
-            if (isdigit (*format))
+            if (c_isdigit (*format))
               {
                 const char *f = format;
                 unsigned int m = 0;
@@ -134,7 +128,7 @@ format_parse (const char *format, bool translated, char *fdi,
                     m = 10 * m + (*f - '0');
                     f++;
                   }
-                while (isdigit (*f));
+                while (c_isdigit (*f));
 
                 if (*f == '$')
                   {
@@ -171,11 +165,11 @@ format_parse (const char *format, bool translated, char *fdi,
               }
 
             /* Parse width.  */
-            if (isdigit (*format))
+            if (c_isdigit (*format))
               {
                 do
                   format++;
-                while (isdigit (*format));
+                while (c_isdigit (*format));
               }
 
             /* Parse precision.  */
@@ -183,11 +177,11 @@ format_parse (const char *format, bool translated, char *fdi,
               {
                 format++;
 
-                if (isdigit (*format))
+                if (c_isdigit (*format))
                   {
                     do
                       format++;
-                    while (isdigit (*format));
+                    while (c_isdigit (*format));
                   }
                 else
                   --format;     /* will jump to bad_format */
index 79d118b37b85b1ce18fe9d88a684c315a750535a..9359abc3c384d5bbd06e194990871212c51998c3 100644 (file)
@@ -1,5 +1,5 @@
 /* Python format strings.
-   Copyright (C) 2001-2024 Free Software Foundation, Inc.
+   Copyright (C) 2001-2025 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software: you can redistribute it and/or modify
@@ -96,12 +96,6 @@ struct spec
   struct unnamed_arg *unnamed;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 
 static int
 named_arg_compare (const void *p1, const void *p2)
@@ -199,9 +193,9 @@ format_parse (const char *format, bool translated, char *fdi,
             spec.unnamed[spec.unnamed_arg_count].type = FAT_INTEGER;
             spec.unnamed_arg_count++;
           }
-        else if (isdigit (*format))
+        else if (c_isdigit (*format))
           {
-            do format++; while (isdigit (*format));
+            do format++; while (c_isdigit (*format));
           }
 
         if (*format == '.')
@@ -228,7 +222,7 @@ format_parse (const char *format, bool translated, char *fdi,
                 spec.unnamed[spec.unnamed_arg_count].type = FAT_INTEGER;
                 spec.unnamed_arg_count++;
               }
-            else if (isdigit (*format))
+            else if (c_isdigit (*format))
               {
                 zero_precision = true;
                 do
@@ -237,7 +231,7 @@ format_parse (const char *format, bool translated, char *fdi,
                       zero_precision = false;
                     format++;
                   }
-                while (isdigit (*format));
+                while (c_isdigit (*format));
               }
           }
 
index 88a5d8a755d8cd4322a4bf2d954bd26536c69629..b26922f6402c589bd18537303df2e4db25aaa36f 100644 (file)
@@ -104,12 +104,6 @@ struct spec
   struct numbered_arg *numbered;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 
 static int
 named_arg_compare (const void *p1, const void *p2)
@@ -259,7 +253,7 @@ format_parse (const char *format, bool translated, char *fdi,
                 continue;
               }
 
-            if (isdigit (*format))
+            if (c_isdigit (*format))
               {
                 unsigned int m = 0;
 
@@ -271,7 +265,7 @@ format_parse (const char *format, bool translated, char *fdi,
                       m = UINT_MAX - 1;
                     format++;
                   }
-                while (isdigit (*format));
+                while (c_isdigit (*format));
 
                 if (*format == '$')
                   {
@@ -322,7 +316,7 @@ format_parse (const char *format, bool translated, char *fdi,
                 /* Parse width.  */
                 format++;
 
-                if (isdigit (*format))
+                if (c_isdigit (*format))
                   {
                     const char *f = format;
                     unsigned int m = 0;
@@ -335,7 +329,7 @@ format_parse (const char *format, bool translated, char *fdi,
                           m = UINT_MAX - 1;
                         f++;
                       }
-                    while (isdigit (*f));
+                    while (c_isdigit (*f));
 
                     if (*f == '$')
                       {
@@ -417,7 +411,7 @@ format_parse (const char *format, bool translated, char *fdi,
                   {
                     format++;
 
-                    if (isdigit (*format))
+                    if (c_isdigit (*format))
                       {
                         const char *f = format;
                         unsigned int m = 0;
@@ -430,7 +424,7 @@ format_parse (const char *format, bool translated, char *fdi,
                               m = UINT_MAX - 1;
                             f++;
                           }
-                        while (isdigit (*f));
+                        while (c_isdigit (*f));
 
                         if (*f == '$')
                           {
@@ -491,7 +485,7 @@ format_parse (const char *format, bool translated, char *fdi,
                     continue;
                   }
 
-                while (isdigit (*format))
+                while (c_isdigit (*format))
                   format++;
 
                 /* Seen a constant precision.  */
index ff722b515797d95d41e7ecbf21be74fa14f00fc0..8dbdee2c1816ddbab7cbeb247660dc84fae2ff7b 100644 (file)
@@ -1,5 +1,5 @@
 /* Tcl format strings.
-   Copyright (C) 2001-2004, 2006-2007, 2009, 2019-2020, 2023 Free Software Foundation, Inc.
+   Copyright (C) 2001-2025 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2002.
 
    This program is free software: you can redistribute it and/or modify
@@ -79,12 +79,6 @@ struct spec
   struct numbered_arg *numbered;
 };
 
-/* Locale independent test for a decimal digit.
-   Argument can be  'char' or 'unsigned char'.  (Whereas the argument of
-   <ctype.h> isdigit must be an 'unsigned char'.)  */
-#undef isdigit
-#define isdigit(c) ((unsigned int) ((c) - '0') < 10)
-
 
 static int
 numbered_arg_compare (const void *p1, const void *p2)
@@ -130,7 +124,7 @@ format_parse (const char *format, bool translated, char *fdi,
             enum format_arg_type type;
 
             is_numbered_arg = false;
-            if (isdigit (*format))
+            if (c_isdigit (*format))
               {
                 const char *f = format;
                 unsigned int m = 0;
@@ -140,7 +134,7 @@ format_parse (const char *format, bool translated, char *fdi,
                     m = 10 * m + (*f - '0');
                     f++;
                   }
-                while (isdigit (*f));
+                while (c_isdigit (*f));
 
                 if (*f == '$')
                   {
@@ -198,9 +192,9 @@ format_parse (const char *format, bool translated, char *fdi,
 
                 number++;
               }
-            else if (isdigit (*format))
+            else if (c_isdigit (*format))
               {
-                do format++; while (isdigit (*format));
+                do format++; while (c_isdigit (*format));
               }
 
             /* Parse precision.  */
@@ -223,9 +217,9 @@ format_parse (const char *format, bool translated, char *fdi,
 
                     number++;
                   }
-                else if (isdigit (*format))
+                else if (c_isdigit (*format))
                   {
-                    do format++; while (isdigit (*format));
+                    do format++; while (c_isdigit (*format));
                   }
               }