aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2018-12-21 18:52:40 +0000
committerWilco Dijkstra <wdijkstr@arm.com>2018-12-21 18:52:40 +0000
commit90d3320d7f57fae3d2f89d907e8307b6a76d133d (patch)
treef9089d25d13b05f53aa2e579c34be4e13f44e857
parent5d025ea61762c5995abb2273780f4cf28f17cedf (diff)
downloadglibc-90d3320d7f57fae3d2f89d907e8307b6a76d133d.zip
glibc-90d3320d7f57fae3d2f89d907e8307b6a76d133d.tar.gz
glibc-90d3320d7f57fae3d2f89d907e8307b6a76d133d.tar.bz2
Refactor string benchtests
Refactor string benchtests by moving duplicated defines into bench-string.h. * 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.
-rw-r--r--ChangeLog24
-rw-r--r--benchtests/bench-memchr.c5
-rw-r--r--benchtests/bench-memcmp.c19
-rw-r--r--benchtests/bench-memset-large.c7
-rw-r--r--benchtests/bench-memset-walk.c7
-rw-r--r--benchtests/bench-memset.c7
-rw-r--r--benchtests/bench-stpcpy.c6
-rw-r--r--benchtests/bench-stpncpy.c8
-rw-r--r--benchtests/bench-strcat.c13
-rw-r--r--benchtests/bench-strchr.c17
-rw-r--r--benchtests/bench-strcmp.c22
-rw-r--r--benchtests/bench-strcpy.c17
-rw-r--r--benchtests/bench-strcspn.c9
-rw-r--r--benchtests/bench-string.h50
-rw-r--r--benchtests/bench-strlen.c5
-rw-r--r--benchtests/bench-strncat.c13
-rw-r--r--benchtests/bench-strncmp.c8
-rw-r--r--benchtests/bench-strncpy.c18
-rw-r--r--benchtests/bench-strnlen.c9
-rw-r--r--benchtests/bench-strpbrk.c14
-rw-r--r--benchtests/bench-strrchr.c11
-rw-r--r--benchtests/bench-strspn.c13
22 files changed, 95 insertions, 207 deletions
diff --git a/ChangeLog b/ChangeLog
index e2d9335..fc7ce6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2018-12-21 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.
+
2018-12-21 Joseph Myers <joseph@codesourcery.com>
* stdlib/longlong.h: Update from GCC.
diff --git a/benchtests/bench-memchr.c b/benchtests/bench-memchr.c
index 2603cdc..73f8a88 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 b566f48..3c1e904 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 1f7bf81..88b89da 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 753d6f3..8b42cc3 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 a47620c..85bb2b3 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 490cf88..77ffb0f 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 488ed42..40c82cf 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 9930188..6b3b084 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 56d58fcd..a773069 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 325cfc5..f5e8b9c 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 c0435a8..e5fd27f 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 9b9f703..5ac8a59 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 f838998..f173a57 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 5768494..4c26890 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 a47f0db..7e01122 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 92cf0d2..65ebb34 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 62daef6..7995375 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 5c10a16..8a76416 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 4217699..4f9d802 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 029ea18..4218912 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 35afdd4..14a9837 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 */