aboutsummaryrefslogtreecommitdiff
path: root/string/test-strpbrk.c
diff options
context:
space:
mode:
Diffstat (limited to 'string/test-strpbrk.c')
-rw-r--r--string/test-strpbrk.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/string/test-strpbrk.c b/string/test-strpbrk.c
index 05fd81e..de8dc0a 100644
--- a/string/test-strpbrk.c
+++ b/string/test-strpbrk.c
@@ -47,22 +47,17 @@
# 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 */
typedef CHAR *(*proto_t) (const CHAR *, const CHAR *);
-CHAR *SIMPLE_STRPBRK (const CHAR *, const CHAR *);
-CHAR *STUPID_STRPBRK (const CHAR *, const CHAR *);
-IMPL (STUPID_STRPBRK, 0)
-IMPL (SIMPLE_STRPBRK, 0)
IMPL (STRPBRK, 1)
+/* Naive implementation to verify results. */
CHAR *
SIMPLE_STRPBRK (const CHAR *s, const CHAR *rej)
{
@@ -72,22 +67,10 @@ SIMPLE_STRPBRK (const CHAR *s, const CHAR *rej)
while ((c = *s++) != '\0')
for (r = rej; *r != '\0'; ++r)
if (*r == c)
- return (CHAR *) s - 1;
+ return (CHAR *) s - 1;
return NULL;
}
-CHAR *
-STUPID_STRPBRK (const CHAR *s, const CHAR *rej)
-{
- size_t ns = STRLEN (s), nrej = STRLEN (rej);
- size_t i, j;
-
- for (i = 0; i < ns; ++i)
- for (j = 0; j < nrej; ++j)
- if (s[i] == rej[j])
- return (CHAR *) s + i;
- return NULL;
-}
#endif /* !STRPBRK_RESULT */
static void