public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] string: Hook up the default implementation on test-strnlen
@ 2023-02-06 20:14 Adhemerval Zanella
  0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2023-02-06 20:14 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b79cffb39185301d50dc42db2dfaf1d971be12c3

commit b79cffb39185301d50dc42db2dfaf1d971be12c3
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Jan 17 10:11:36 2023 -0300

    string: Hook up the default implementation on test-strnlen
    
    Also remove the SIMPLE_STRNLEN, which is not used anywhere.
    
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Diff:
---
 string/test-strnlen.c | 35 ++++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/string/test-strnlen.c b/string/test-strnlen.c
index 8b5372c3a1..ef73dd34f4 100644
--- a/string/test-strnlen.c
+++ b/string/test-strnlen.c
@@ -43,17 +43,30 @@
 
 typedef size_t (*proto_t) (const CHAR *, size_t);
 
-IMPL (STRNLEN, 1)
-
-/* Naive implementation to verify results.  */
-size_t
-SIMPLE_STRNLEN (const CHAR *s, size_t maxlen)
-{
-  size_t i;
-
-  for (i = 0; i < maxlen && s[i]; ++i);
-  return i;
-}
+/* Also check the default implementation.  */
+#undef STRNLEN
+#ifndef WIDE
+# define MEMCHR __memchr_default
+# define weak_alias(a, b)
+# define libc_hidden_def(a)
+# define libc_hidden_builtin_def(a)
+# include "string/memchr.c"
+# undef STRNLEN
+# define STRNLEN __strnlen_default
+# define memchr __memchr_default
+# include "string/strnlen.c"
+IMPL (__strnlen_default, 1)
+#else
+# define WMEMCHR __wmemchr_default
+# define weak_alias(a, b)
+# define libc_hidden_def(a)
+# define libc_hidden_weak(a)
+# include "wcsmbs/wmemchr.c"
+# define WCSNLEN __wcsnlen_default
+# define wmemchr __wmemchr_default
+# include "wcsmbs/wcsnlen.c"
+IMPL (__wcsnlen_default, 1)
+#endif
 
 static void
 do_one_test (impl_t *impl, const CHAR *s, size_t maxlen, size_t exp_len)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-06 20:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-06 20:14 [glibc] string: Hook up the default implementation on test-strnlen Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).