svn commit: trunk/uClibc/libc/string/i386

Mike Frysinger vapier at gentoo.org
Mon Jul 20 12:25:12 UTC 2009


On Friday 19 December 2008 08:51:39 vda at uclibc.org wrote:
> Changeset:
> Modified: trunk/uClibc/libc/string/i386/memchr.c
>
> +/* Uncomment TESTING, gcc -D__USE_GNU -m32 -Os memchr.c -o memchr
> + * and run ./memchr
> + */
> +int main()
> +{
> +	static const char str[] = "abc.def";
> +	printf((char*)memchr(str, '.',-2) - str == 3 ? "ok\n" : "BAD!\n");
> +	printf((char*)memchr(str, '.',-1) - str == 3 ? "ok\n" : "BAD!\n");
> +	printf((char*)memchr(str, '.', 0) == NULL    ? "ok\n" : "BAD!\n");
> +	printf((char*)memchr(str, '.', 1) == NULL    ? "ok\n" : "BAD!\n");
> +	printf((char*)memchr(str, '.', 2) == NULL    ? "ok\n" : "BAD!\n");
> +	printf((char*)memchr(str, '.', 3) == NULL    ? "ok\n" : "BAD!\n");
> +	printf((char*)memchr(str, '.', 4) - str == 3 ? "ok\n" : "BAD!\n");
> +	printf((char*)memchr(str, '.', 5) - str == 3 ? "ok\n" : "BAD!\n");
> +	printf((char*)memchr(str+3, '.', 0) == NULL    ? "ok\n" : "BAD!\n");
> +	printf((char*)memchr(str+3, '.', 5) - str == 3 ? "ok\n" : "BAD!\n");
> +}
> +#endif

you've got to be kidding me.  we have test/string/ for a reason.  if you want 
to make it easier to include on the fly, that's one thing, but the answer is 
most certainly not "let's copy & paste a whole lot of code into the 
implementation".
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20090720/2fb4ecd9/attachment.pgp>


More information about the uClibc mailing list