1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

* string/test-strchr.c (stupid_strchr): New function.

(do_random_tests): Make sure the string is zero terminated.
	* string/test-strpbrk.c (stupid_strpbrk): New function.
	(do_random_tests): Make sure the string is zero terminated.
	* string/test-strcmp.c (stupid_strcmp): New function.
	(do_random_tests): Make sure the strings are zero terminated.
	* string/test-strspn.c (stupid_strspn): New function.
	(simple_strspn): Rename rej argument to acc.
	(do_random_tests): Make sure the string is zero terminated.
	* string/test-strcspn.c (stupid_strcspn): New function.
	* string/test-strncpy.c (stupid_strncpy): New function.
	* string/test-stpncpy.c (stupid_stpncpy): New function.
	* string/test-strncmp.c (stupid_strncmp): New function.
	(do_random_tests): Make sure the strings are zero terminated.
	* string/test-string.h (impl_t): Change test into long.
	(IMPL): Add __attribute__((aligned (sizeof (void *)))).
This commit is contained in:
Roland McGrath
2002-11-08 22:10:01 +00:00
parent e0bc9a8d13
commit e8c1660f7b
10 changed files with 233 additions and 86 deletions

View File

@ -24,7 +24,9 @@
# include "test-string.h"
char *simple_strncpy (char *, const char *, size_t);
char *stupid_strncpy (char *, const char *, size_t);
IMPL (stupid_strncpy, 0)
IMPL (simple_strncpy, 0)
IMPL (strncpy, 1)
@ -41,6 +43,19 @@ simple_strncpy (char *dst, const char *src, size_t n)
}
return ret;
}
char *
stupid_strncpy (char *dst, const char *src, size_t n)
{
size_t ns = strlen (src);
size_t i, nc = n < ns ? n : ns;
for (i = 0; i < nc; ++i)
dst[i] = src[i];
for (; i < n; ++i)
dst[i] = '\0';
return dst;
}
#endif
typedef char *(*proto_t) (char *, const char *, size_t);