]> Savannah Git Hosting - gnulib.git/commitdiff
strtol, strtoul, strtoll, strtoull: Optimize.
authorBruno Haible <bruno@clisp.org>
Fri, 2 Apr 2021 17:50:19 +0000 (19:50 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 2 Apr 2021 17:50:19 +0000 (19:50 +0200)
* lib/strtol.c (GROUP_PARAM_PROTO): New macro.
(INTERNAL): Define differently if !USE_NUMBER_GROUPING.
(INTERNAL (strtol)): Define without 'int group' parameter if
!USE_NUMBER_GROUPING.
(strtol): Don't define if !USE_NUMBER_GROUPING.

ChangeLog
lib/strtol.c

index 0bf4c58da3460acbc2e3a12cfd923136fdba6f40..d5b833ae3bd8852415a5399ce61db8cea3ff2113 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2021-04-02  Bruno Haible  <bruno@clisp.org>
+
+       strtol, strtoul, strtoll, strtoull: Optimize.
+       * lib/strtol.c (GROUP_PARAM_PROTO): New macro.
+       (INTERNAL): Define differently if !USE_NUMBER_GROUPING.
+       (INTERNAL (strtol)): Define without 'int group' parameter if
+       !USE_NUMBER_GROUPING.
+       (strtol): Don't define if !USE_NUMBER_GROUPING.
+
 2021-04-02  Bruno Haible  <bruno@clisp.org>
 
        strto*l: Don't pass invalid arguments to isspace, isalnum, toupper.
index 14836d04d99c520a9919b3186002d9bd418d75fa..c30e5b45e9218204b797ed68a379d196a3b77913 100644 (file)
 #endif
 
 
+#ifdef USE_NUMBER_GROUPING
+# define GROUP_PARAM_PROTO , int group
+#else
+# define GROUP_PARAM_PROTO
+#endif
+
 /* We use this code also for the extended locale handling where the
    function gets as an additional argument the locale which has to be
    used.  To access the values we have to redefine the _NL_CURRENT
 # endif
 #endif
 
-#define INTERNAL(X) INTERNAL1(X)
-#define INTERNAL1(X) __##X##_internal
-#define WEAKNAME(X) WEAKNAME1(X)
+#ifdef USE_NUMBER_GROUPING
+# define INTERNAL(X) INTERNAL1(X)
+# define INTERNAL1(X) __##X##_internal
+# define WEAKNAME(X) WEAKNAME1(X)
+#else
+# define INTERNAL(X) X
+#endif
 
 #ifdef USE_NUMBER_GROUPING
 /* This file defines a function to check for correct grouping.  */
 
 INT
 INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
-                   int base, int group LOCALE_PARAM_PROTO)
+                   int base GROUP_PARAM_PROTO LOCALE_PARAM_PROTO)
 {
   int negative;
   register unsigned LONG int cutoff;
@@ -379,15 +389,16 @@ noconv:
   return 0L;
 }
 \f
+#ifdef USE_NUMBER_GROUPING
 /* External user entry point.  */
 
-
 INT
-#ifdef weak_function
+# ifdef weak_function
 weak_function
-#endif
+# endif
 strtol (const STRING_TYPE *nptr, STRING_TYPE **endptr,
         int base LOCALE_PARAM_PROTO)
 {
   return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM);
 }
+#endif