This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Refactor string benchtests


Refactor string benchtests by moving duplicated defines into
bench-string.h.

OK for commit?

ChangeLog:
2018-12-20  Wilco Dijkstra  <wdijkstr@arm.com>

        * benchtests/bench-memchr.c: Cleanup defines.
        * benchtests/bench-memcmp.c: Likewise.
        * benchtests/bench-memset.c: Likewise.
        * benchtests/bench-memset-large.c: Likewise.
        * benchtests/bench-memset-walk.c: Likewise.
        * benchtests/bench-stpcpy.c: Likewise.
        * benchtests/bench-stpncpy.c: Likewise.
        * benchtests/bench-strcat.c: Likewise.
        * benchtests/bench-strchr.c: Likewise.
        * benchtests/bench-strcmp.c: Likewise.
        * benchtests/bench-strcpy.c: Likewise.
        * benchtests/bench-strcspn.c: Likewise.
        * benchtests/bench-string.h: Likewise.
        * benchtests/bench-strlen.c: Likewise.
        * benchtests/bench-strncat.c: Likewise.
        * benchtests/bench-strncmp.c: Likewise.
        * benchtests/bench-strncpy.c: Likewise.
        * benchtests/bench-strnlen.c: Likewise.
        * benchtests/bench-strpbrk.c: Likewise.
        * benchtests/bench-strrchr.c: Likewise.
	* benchtests/bench-strspn.c: Likewise.

--
diff --git a/benchtests/bench-memchr.c b/benchtests/bench-memchr.c
index 2603cdca99b9f81bc46c5367408edd340bc3cf6b..73f8a88cfd1f3e3e5e2a3752c809fd0c1aef9fb1 100644
--- a/benchtests/bench-memchr.c
+++ b/benchtests/bench-memchr.c
@@ -17,11 +17,8 @@
    <http://www.gnu.org/licenses/>.  */
 
 #ifndef WIDE
-# define CHAR char
 # define SMALL_CHAR 127
 #else
-# include <wchar.h>
-# define CHAR wchar_t
 # define SMALL_CHAR 1273
 #endif /* WIDE */
 
@@ -35,10 +32,8 @@
 # include "bench-string.h"
 
 # ifndef WIDE
-#  define MEMCHR memchr
 #  define SIMPLE_MEMCHR simple_memchr
 # else
-#  define MEMCHR wmemchr
 #  define SIMPLE_MEMCHR simple_wmemchr
 # endif /* WIDE */
 
diff --git a/benchtests/bench-memcmp.c b/benchtests/bench-memcmp.c
index b566f48ae9f3cab2920593b208c28ff39bddfb52..3c1e9047c9a679f413a05ac8c60106742173c13a 100644
--- a/benchtests/bench-memcmp.c
+++ b/benchtests/bench-memcmp.c
@@ -24,17 +24,8 @@
 #endif
 #include "bench-string.h"
 #ifdef WIDE
-# include <inttypes.h>
-# include <wchar.h>
 
-# define MEMCMP wmemcmp
-# define MEMCPY wmemcpy
 # define SIMPLE_MEMCMP simple_wmemcmp
-# define CHAR wchar_t
-# define UCHAR wchar_t
-# define CHARBYTES 4
-# define CHAR__MIN WCHAR_MIN
-# define CHAR__MAX WCHAR_MAX
 int
 simple_wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n)
 {
@@ -49,15 +40,7 @@ simple_wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n)
 #else
 # include <limits.h>
 
-# define MEMCMP memcmp
-# define MEMCPY memcpy
 # define SIMPLE_MEMCMP simple_memcmp
-# define CHAR char
-# define MAX_CHAR 255
-# define UCHAR unsigned char
-# define CHARBYTES 1
-# define CHAR__MIN CHAR_MIN
-# define CHAR__MAX CHAR_MAX
 
 int
 simple_memcmp (const char *s1, const char *s2, size_t n)
@@ -125,7 +108,7 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t align2, size_t len,
       s2 = (CHAR *) (buf2 + align2);
 
       for (i = 0; i < len; i++)
-	s1[i] = s2[i] = 1 + (23 << ((CHARBYTES - 1) * 8)) * i % CHAR__MAX;
+	s1[i] = s2[i] = 1 + (23 << ((CHARBYTES - 1) * 8)) * i % MAX_CHAR;
 
       s1[len] = align1;
       s2[len] = align2;
diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
index 1f7bf81fd1063a0469eb23efdb1480356a1c1c6a..88b89da9aa0d0858378f025a8f492674dec89d8d 100644
--- a/benchtests/bench-memset-large.c
+++ b/benchtests/bench-memset-large.c
@@ -28,16 +28,9 @@
 #include "bench-string.h"
 
 #ifndef WIDE
-# define MEMSET memset
-# define CHAR char
 # define SIMPLE_MEMSET simple_memset
-# define MEMCMP memcmp
 #else
-# include <wchar.h>
-# define MEMSET wmemset
-# define CHAR wchar_t
 # define SIMPLE_MEMSET simple_wmemset
-# define MEMCMP wmemcmp
 #endif /* WIDE */
 
 #include <assert.h>
diff --git a/benchtests/bench-memset-walk.c b/benchtests/bench-memset-walk.c
index 753d6f36f3f371e18330972b3eeee444d5374201..8b42cc3880c2850c8cb64e09b6cead965afe85aa 100644
--- a/benchtests/bench-memset-walk.c
+++ b/benchtests/bench-memset-walk.c
@@ -28,16 +28,9 @@
 #include "bench-string.h"
 
 #ifndef WIDE
-# define MEMSET memset
-# define CHAR char
 # define SIMPLE_MEMSET simple_memset
-# define MEMCMP memcmp
 #else
-# include <wchar.h>
-# define MEMSET wmemset
-# define CHAR wchar_t
 # define SIMPLE_MEMSET simple_wmemset
-# define MEMCMP wmemcmp
 #endif /* WIDE */
 
 #include <assert.h>
diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c
index a47620cbfca6cbf2e582aa2288263c716836c9bd..85bb2b314a98827f6a19e073212ecb56801e3c4e 100644
--- a/benchtests/bench-memset.c
+++ b/benchtests/bench-memset.c
@@ -30,16 +30,9 @@
 #include "bench-string.h"
 
 #ifndef WIDE
-# define MEMSET memset
-# define CHAR char
 # define SIMPLE_MEMSET simple_memset
-# define MEMCMP memcmp
 #else
-# include <wchar.h>
-# define MEMSET wmemset
-# define CHAR wchar_t
 # define SIMPLE_MEMSET simple_wmemset
-# define MEMCMP wmemcmp
 #endif /* WIDE */
 
 #include "json-lib.h"
diff --git a/benchtests/bench-stpcpy.c b/benchtests/bench-stpcpy.c
index 490cf88414d65f348c845db01bd9a798575de9ce..77ffb0f5c22b8d8ba83d46e903a23c90d8c983c1 100644
--- a/benchtests/bench-stpcpy.c
+++ b/benchtests/bench-stpcpy.c
@@ -25,14 +25,9 @@
 #endif /* WIDE */
 #include "bench-string.h"
 #ifndef WIDE
-# define CHAR char
 # define SIMPLE_STPCPY simple_stpcpy
-# define STPCPY stpcpy
 #else
-# include <wchar.h>
-# define CHAR wchar_t
 # define SIMPLE_STPCPY simple_wcpcpy
-# define STPCPY wcpcpy
 #endif /* WIDE */
 
 CHAR *SIMPLE_STPCPY (CHAR *, const CHAR *);
@@ -47,5 +42,4 @@ SIMPLE_STPCPY (CHAR *dst, const CHAR *src)
   return dst - 1;
 }
 
-#undef CHAR
 #include "bench-strcpy.c"
diff --git a/benchtests/bench-stpncpy.c b/benchtests/bench-stpncpy.c
index 488ed42db2c55fe61c92b70ee16a36ebd543cdb4..40c82cf716e6d7bc8fcb8d5a390da1ee8fee3245 100644
--- a/benchtests/bench-stpncpy.c
+++ b/benchtests/bench-stpncpy.c
@@ -25,18 +25,11 @@
 #endif /* WIDE */
 #include "bench-string.h"
 #ifndef WIDE
-# define CHAR char
 # define SIMPLE_STPNCPY simple_stpncpy
 # define STUPID_STPNCPY stupid_stpncpy
-# define STPNCPY stpncpy
-# define STRNLEN strnlen
 #else
-# include <wchar.h>
-# define CHAR wchar_t
 # define SIMPLE_STPNCPY simple_wcpncpy
 # define STUPID_STPNCPY stupid_wcpncpy
-# define STPNCPY wcpncpy
-# define STRNLEN wcsnlen
 #endif /* WIDE */
 
 CHAR *SIMPLE_STPNCPY (CHAR *, const CHAR *, size_t);
@@ -74,5 +67,4 @@ STUPID_STPNCPY (CHAR *dst, const CHAR *src, size_t n)
   return dst + nc;
 }
 
-#undef CHAR
 #include "bench-strncpy.c"
diff --git a/benchtests/bench-strcat.c b/benchtests/bench-strcat.c
index 9930188e3175767772f9ec3347d0bcf992f042b8..6b3b084ae19a931cb2bda07794380b5745ccfc86 100644
--- a/benchtests/bench-strcat.c
+++ b/benchtests/bench-strcat.c
@@ -24,24 +24,15 @@
 #endif /* WIDE */
 #include "bench-string.h"
 
+#define BIG_CHAR MAX_CHAR
+
 #ifndef WIDE
-# define STRCAT strcat
-# define CHAR char
 # define sfmt "s"
 # define SIMPLE_STRCAT simple_strcat
-# define STRLEN strlen
-# define STRCMP strcmp
-# define BIG_CHAR CHAR_MAX
 # define SMALL_CHAR 127
 #else
-# include <wchar.h>
-# define STRCAT wcscat
-# define CHAR wchar_t
 # define sfmt "ls"
 # define SIMPLE_STRCAT simple_wcscat
-# define STRLEN wcslen
-# define STRCMP wcscmp
-# define BIG_CHAR WCHAR_MAX
 # define SMALL_CHAR 1273
 #endif /* WIDE */
 
diff --git a/benchtests/bench-strchr.c b/benchtests/bench-strchr.c
index 56d58fcd51e129fa96b43845883ba8cf59d2057e..a7730699890a26eff199fc9eff945e79929587db 100644
--- a/benchtests/bench-strchr.c
+++ b/benchtests/bench-strchr.c
@@ -32,35 +32,26 @@
 #endif /* WIDE */
 #include "bench-string.h"
 
+#define BIG_CHAR MAX_CHAR
+
 #ifndef WIDE
 # ifdef USE_FOR_STRCHRNUL
+#  undef STRCHR
 #  define STRCHR strchrnul
 #  define stupid_STRCHR stupid_STRCHRNUL
 #  define simple_STRCHR simple_STRCHRNUL
-# else
-#  define STRCHR strchr
 # endif /* !USE_FOR_STRCHRNUL */
-# define STRLEN strlen
-# define CHAR char
-# define BIG_CHAR CHAR_MAX
 # define MIDDLE_CHAR 127
 # define SMALL_CHAR 23
-# define UCHAR unsigned char
 #else
-# include <wchar.h>
 # ifdef USE_FOR_STRCHRNUL
+#  undef STRCHR
 #  define STRCHR wcschrnul
 #  define stupid_STRCHR stupid_WCSCHRNUL
 #  define simple_STRCHR simple_WCSCHRNUL
-# else
-#  define STRCHR wcschr
 # endif /* !USE_FOR_STRCHRNUL */
-# define STRLEN wcslen
-# define CHAR wchar_t
-# define BIG_CHAR WCHAR_MAX
 # define MIDDLE_CHAR 1121
 # define SMALL_CHAR 851
-# define UCHAR wchar_t
 #endif /* WIDE */
 
 #ifdef USE_FOR_STRCHRNUL
diff --git a/benchtests/bench-strcmp.c b/benchtests/bench-strcmp.c
index 325cfc5a4843430a9dd394aaadb855e7756f0bfb..f5e8b9cc95f40597ff321adeaa864ca01b6a96cc 100644
--- a/benchtests/bench-strcmp.c
+++ b/benchtests/bench-strcmp.c
@@ -25,24 +25,12 @@
 #include "bench-string.h"
 
 #ifdef WIDE
-# include <wchar.h>
-
 # define L(str) L##str
-# define STRCMP wcscmp
-# define STRCPY wcscpy
-# define STRLEN wcslen
-# define MEMCPY wmemcpy
 # define SIMPLE_STRCMP simple_wcscmp
 # define STUPID_STRCMP stupid_wcscmp
-# define CHAR wchar_t
-# define UCHAR wchar_t
-# define CHARBYTES 4
 # define CHARBYTESLOG 2
-# define CHARALIGN __alignof__ (CHAR)
 # define MIDCHAR 0x7fffffff
 # define LARGECHAR 0xfffffffe
-# define CHAR__MAX WCHAR_MAX
-# define CHAR__MIN WCHAR_MIN
 
 /* Wcscmp uses signed semantics for comparison, not unsigned */
 /* Avoid using substraction since possible overflow */
@@ -86,21 +74,11 @@ stupid_wcscmp (const wchar_t *s1, const wchar_t *s2)
 # include <limits.h>
 
 # define L(str) str
-# define STRCMP strcmp
-# define STRCPY strcpy
-# define STRLEN strlen
-# define MEMCPY memcpy
 # define SIMPLE_STRCMP simple_strcmp
 # define STUPID_STRCMP stupid_strcmp
-# define CHAR char
-# define UCHAR unsigned char
-# define CHARBYTES 1
 # define CHARBYTESLOG 0
-# define CHARALIGN 1
 # define MIDCHAR 0x7f
 # define LARGECHAR 0xfe
-# define CHAR__MAX CHAR_MAX
-# define CHAR__MIN CHAR_MIN
 
 /* Strcmp uses unsigned semantics for comparison. */
 int
diff --git a/benchtests/bench-strcpy.c b/benchtests/bench-strcpy.c
index c0435a895cd0d240a42f5e140bed04540a00d9e8..e5fd27ffba9ca6dd871e658d1cffc22f28047e49 100644
--- a/benchtests/bench-strcpy.c
+++ b/benchtests/bench-strcpy.c
@@ -16,25 +16,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define BIG_CHAR MAX_CHAR
+
 #ifdef WIDE
-# include <wchar.h>
-# define CHAR wchar_t
-# define UCHAR wchar_t
 # define sfmt "ls"
-# define BIG_CHAR WCHAR_MAX
 # define SMALL_CHAR 1273
-# define STRCMP wcscmp
-# define MEMCMP wmemcmp
-# define MEMSET wmemset
 #else
-# define CHAR char
-# define UCHAR unsigned char
 # define sfmt "s"
-# define BIG_CHAR CHAR_MAX
 # define SMALL_CHAR 127
-# define STRCMP strcmp
-# define MEMCMP memcmp
-# define MEMSET memset
 #endif
 
 #ifndef STRCPY_RESULT
@@ -48,10 +37,8 @@
 # include "bench-string.h"
 # ifndef WIDE
 #  define SIMPLE_STRCPY simple_strcpy
-#  define STRCPY strcpy
 # else
 #  define SIMPLE_STRCPY simple_wcscpy
-#  define STRCPY wcscpy
 # endif
 
 CHAR *SIMPLE_STRCPY (CHAR *, const CHAR *);
diff --git a/benchtests/bench-strcspn.c b/benchtests/bench-strcspn.c
index 9b9f7035a9d7e5c3c8f9a6eb9c417109afdd8f3f..5ac8a596a77a4e9ddbcca338079c0e918cb57d36 100644
--- a/benchtests/bench-strcspn.c
+++ b/benchtests/bench-strcspn.c
@@ -27,18 +27,11 @@
 #include "bench-string.h"
 
 #ifndef WIDE
-# define STRCSPN strcspn
-# define CHAR char
 # define SIMPLE_STRCSPN simple_strcspn
 # define STUPID_STRCSPN stupid_strcspn
-# define STRLEN strlen
 #else
-# include <wchar.h>
-# define STRCSPN wcscspn
-# define CHAR wchar_t
 # define SIMPLE_STRCSPN simple_wcscspn
 # define STUPID_STRCSPN stupid_wcscspn
-# define STRLEN wcslen
 #endif /* WIDE */
 
 typedef size_t (*proto_t) (const CHAR *, const CHAR *);
@@ -75,6 +68,4 @@ STUPID_STRCSPN (const CHAR *s, const CHAR *rej)
   return i;
 }
 
-#undef CHAR
-#undef STRLEN
 #include "bench-strpbrk.c"
diff --git a/benchtests/bench-string.h b/benchtests/bench-string.h
index f8389982e9106df83d755a31188100cc85f38ac9..f173a57efae98c643adcbc6e505442bc79f857d1 100644
--- a/benchtests/bench-string.h
+++ b/benchtests/bench-string.h
@@ -65,6 +65,56 @@ extern impl_t __start_impls[], __stop_impls[];
 # define GLRO(x) _##x
 # include "bench-timing.h"
 
+# ifndef WIDE
+#  define CHAR char
+#  define UCHAR unsigned char
+#  define CHARBYTES 1
+#  define MAX_CHAR CHAR_MAX
+#  define MEMCHR memchr
+#  define MEMCMP memcmp
+#  define MEMCPY memcpy
+#  define MEMSET memset
+#  define STRCAT strcat
+#  define STRLEN strlen
+#  define STRCMP strcmp
+#  define STRCHR strchr
+#  define STRCPY strcpy
+#  define STRNLEN strnlen
+#  define STRCSPN strcspn
+#  define STRNCAT strncat
+#  define STRNCMP strncmp
+#  define STRNCPY strncpy
+#  define STRPBRK strpbrk
+#  define STRRCHR strrchr
+#  define STRSPN strspn
+#  define STPCPY stpcpy
+#  define STPNCPY stpncpy
+# else
+#  include <wchar.h>
+#  define CHAR wchar_t
+#  define UCHAR wchar_t
+#  define CHARBYTES 4
+#  define MAX_CHAR WCHAR_MAX
+#  define MEMCHR wmemchr
+#  define MEMCMP wmemcmp
+#  define MEMCPY wmemcpy
+#  define MEMSET wmemset
+#  define STRCAT wcscat
+#  define STRLEN wcslen
+#  define STRCMP wcscmp
+#  define STRCHR wcschr
+#  define STRCPY wcscpy
+#  define STRNLEN wcsnlen
+#  define STRCSPN wcscspn
+#  define STRNCAT wcsncat
+#  define STRNCMP wcsncmp
+#  define STRNCPY wcsncpy
+#  define STRPBRK wcspbrk
+#  define STRRCHR wcsrchr
+#  define STRSPN wcsspn
+#  define STPCPY wcpcpy
+#  define STPNCPY wcpncpy
+# endif /* WIDE */
 
 # define TEST_FUNCTION test_main
 # ifndef TIMEOUT
diff --git a/benchtests/bench-strlen.c b/benchtests/bench-strlen.c
index 576849400f6c44f4f35c8e8656b664a890aece51..4c26890e23c2e08e2237cf0327cc4b0e4b2f2259 100644
--- a/benchtests/bench-strlen.c
+++ b/benchtests/bench-strlen.c
@@ -25,13 +25,8 @@
 #include "bench-string.h"
 
 #ifndef WIDE
-# define STRLEN strlen
-# define CHAR char
 # define MAX_CHAR CHAR_MAX
 #else
-# include <wchar.h>
-# define STRLEN wcslen
-# define CHAR wchar_t
 # define MAX_CHAR WCHAR_MAX
 #endif
 
diff --git a/benchtests/bench-strncat.c b/benchtests/bench-strncat.c
index a47f0db2869543e1dfef042eeeebb10cc2fd611b..7e0112273ba0727ae29407e38724c39159ce1c93 100644
--- a/benchtests/bench-strncat.c
+++ b/benchtests/bench-strncat.c
@@ -24,24 +24,15 @@
 #endif /* WIDE */
 #include "bench-string.h"
 
+#define BIG_CHAR MAX_CHAR
+
 #ifndef WIDE
-# define STRNCAT strncat
-# define CHAR char
 # define SIMPLE_STRNCAT simple_strncat
 # define STUPID_STRNCAT stupid_strncat
-# define STRLEN strlen
-# define MEMCMP memcmp
-# define BIG_CHAR CHAR_MAX
 # define SMALL_CHAR 127
 #else
-# include <wchar.h>
-# define STRNCAT wcsncat
-# define CHAR wchar_t
 # define SIMPLE_STRNCAT simple_wcsncat
 # define STUPID_STRNCAT stupid_wcsncat
-# define STRLEN wcslen
-# define MEMCMP wmemcmp
-# define BIG_CHAR WCHAR_MAX
 # define SMALL_CHAR 1273
 #endif /* WIDE */
 
diff --git a/benchtests/bench-strncmp.c b/benchtests/bench-strncmp.c
index 92cf0d214553c71ae2a0f09e8ec3a3ce08a4c204..65ebb3445d62e5015ed785dfbc3e3b905dbdcafa 100644
--- a/benchtests/bench-strncmp.c
+++ b/benchtests/bench-strncmp.c
@@ -26,14 +26,9 @@
 #include "json-lib.h"
 
 #ifdef WIDE
-# include <wchar.h>
-
 # define L(str) L##str
-# define STRNCMP wcsncmp
 # define SIMPLE_STRNCMP simple_wcsncmp
 # define STUPID_STRNCMP stupid_wcsncmp
-# define CHAR wchar_t
-# define CHARBYTES 4
 
 /* Wcsncmp uses signed semantics for comparison, not unsigned.
    Avoid using substraction since possible overflow.  */
@@ -73,11 +68,8 @@ stupid_wcsncmp (const CHAR *s1, const CHAR *s2, size_t n)
 
 #else
 # define L(str) str
-# define STRNCMP strncmp
 # define SIMPLE_STRNCMP simple_strncmp
 # define STUPID_STRNCMP stupid_strncmp
-# define CHAR char
-# define CHARBYTES 1
 
 /* Strncmp uses unsigned semantics for comparison.  */
 int
diff --git a/benchtests/bench-strncpy.c b/benchtests/bench-strncpy.c
index 62daef6b845b230ee2cad117a914b37a7b045eba..79953759bfbd7201b9e3a846b59666375cb76348 100644
--- a/benchtests/bench-strncpy.c
+++ b/benchtests/bench-strncpy.c
@@ -16,26 +16,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define BIG_CHAR MAX_CHAR
+
 #ifdef WIDE
-# include <wchar.h>
-# define CHAR wchar_t
-# define UCHAR wchar_t
-# define BIG_CHAR WCHAR_MAX
 # define SMALL_CHAR 1273
-# define MEMCMP wmemcmp
-# define MEMSET wmemset
-# define STRNLEN wcsnlen
 #else
-# define CHAR char
-# define UCHAR unsigned char
-# define BIG_CHAR CHAR_MAX
 # define SMALL_CHAR 127
-# define MEMCMP memcmp
-# define MEMSET memset
-# define STRNLEN strnlen
 #endif /* !WIDE */
 
-
 #ifndef STRNCPY_RESULT
 # define STRNCPY_RESULT(dst, len, n) dst
 # define TEST_MAIN
@@ -48,11 +36,9 @@
 # ifndef WIDE
 #  define SIMPLE_STRNCPY simple_strncpy
 #  define STUPID_STRNCPY stupid_strncpy
-#  define STRNCPY strncpy
 # else
 #  define SIMPLE_STRNCPY simple_wcsncpy
 #  define STUPID_STRNCPY stupid_wcsncpy
-#  define STRNCPY wcsncpy
 # endif /* WIDE */
 
 CHAR *SIMPLE_STRNCPY (CHAR *, const CHAR *, size_t);
diff --git a/benchtests/bench-strnlen.c b/benchtests/bench-strnlen.c
index 5c10a16e90d92e01bf372f6b67b5c1fa927cfb14..8a7641669a36603e3943b5ca3b9cb0f648dd18f0 100644
--- a/benchtests/bench-strnlen.c
+++ b/benchtests/bench-strnlen.c
@@ -24,17 +24,12 @@
 #endif /* WIDE */
 #include "bench-string.h"
 
+#define BIG_CHAR MAX_CHAR
+
 #ifndef WIDE
-# define STRNLEN strnlen
-# define CHAR char
-# define BIG_CHAR CHAR_MAX
 # define MIDDLE_CHAR 127
 # define SIMPLE_STRNLEN simple_strnlen
 #else
-# include <wchar.h>
-# define STRNLEN wcsnlen
-# define CHAR wchar_t
-# define BIG_CHAR WCHAR_MAX
 # define MIDDLE_CHAR 1121
 # define SIMPLE_STRNLEN simple_wcsnlen
 #endif /* WIDE */
diff --git a/benchtests/bench-strpbrk.c b/benchtests/bench-strpbrk.c
index 4217699376a937917f1ec5a23a11912d9b538832..4f9d8025985006b60143f59c36fe0185702d5043 100644
--- a/benchtests/bench-strpbrk.c
+++ b/benchtests/bench-strpbrk.c
@@ -16,18 +16,11 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define BIG_CHAR MAX_CHAR
+
 #ifndef WIDE
-# define CHAR char
-# define STRLEN strlen
-# define STRCHR strchr
-# define BIG_CHAR CHAR_MAX
 # define SMALL_CHAR 127
 #else
-# include <wchar.h>
-# define CHAR wchar_t
-# define STRLEN wcslen
-# define STRCHR wcschr
-# define BIG_CHAR WCHAR_MAX
 # define SMALL_CHAR 1273
 #endif /* WIDE */
 
@@ -43,12 +36,9 @@
 # include "bench-string.h"
 
 # ifndef WIDE
-#  define STRPBRK strpbrk
 #  define SIMPLE_STRPBRK simple_strpbrk
 #  define STUPID_STRPBRK stupid_strpbrk
 # else
-#  include <wchar.h>
-#  define STRPBRK wcspbrk
 #  define SIMPLE_STRPBRK simple_wcspbrk
 #  define STUPID_STRPBRK stupid_wcspbrk
 # endif /* WIDE */
diff --git a/benchtests/bench-strrchr.c b/benchtests/bench-strrchr.c
index 029ea184e8a2f0ece7dd02fd38515f69b890bada..42189124edf8b4977723ec58f6c42a7b23602efe 100644
--- a/benchtests/bench-strrchr.c
+++ b/benchtests/bench-strrchr.c
@@ -24,20 +24,13 @@
 #endif
 #include "bench-string.h"
 
+#define BIG_CHAR MAX_CHAR
+
 #ifdef WIDE
-# include <wchar.h>
 # define SIMPLE_STRRCHR simple_wcsrchr
-# define STRRCHR wcsrchr
-# define CHAR wchar_t
-# define UCHAR wchar_t
-# define BIG_CHAR WCHAR_MAX
 # define SMALL_CHAR 1273
 #else
 # define SIMPLE_STRRCHR simple_strrchr
-# define STRRCHR strrchr
-# define CHAR char
-# define UCHAR unsigned char
-# define BIG_CHAR CHAR_MAX
 # define SMALL_CHAR 127
 #endif
 
diff --git a/benchtests/bench-strspn.c b/benchtests/bench-strspn.c
index 35afdd467cb464958e7f7cb4b6d1601c43f6cf9b..14a983744ef9dc80fffb763c3da39606508f800b 100644
--- a/benchtests/bench-strspn.c
+++ b/benchtests/bench-strspn.c
@@ -24,24 +24,15 @@
 #endif /* WIDE */
 #include "bench-string.h"
 
+#define BIG_CHAR MAX_CHAR
+
 #ifndef WIDE
-# define STRSPN strspn
-# define CHAR char
 # define SIMPLE_STRSPN simple_strspn
 # define STUPID_STRSPN stupid_strspn
-# define STRLEN strlen
-# define STRCHR strchr
-# define BIG_CHAR CHAR_MAX
 # define SMALL_CHAR 127
 #else
-# include <wchar.h>
-# define STRSPN wcsspn
-# define CHAR wchar_t
 # define SIMPLE_STRSPN simple_wcsspn
 # define STUPID_STRSPN stupid_wcsspn
-# define STRLEN wcslen
-# define STRCHR wcschr
-# define BIG_CHAR WCHAR_MAX
 # define SMALL_CHAR 1273
 #endif /* WIDE */
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]