Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Feb 2009 22:04:18 +0300
From:      Andrey Chernov <ache@nagual.pp.ru>
To:        Warner Losh <imp@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r188098 - head/lib/libc/string
Message-ID:  <20090207190418.GA336@nagual.pp.ru>
In-Reply-To: <200902032025.n13KPaCV041012@svn.freebsd.org>
References:  <200902032025.n13KPaCV041012@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 03, 2009 at 08:25:36PM +0000, Warner Losh wrote:
> ==============================================================================
> --- head/lib/libc/string/memchr.c	Tue Feb  3 20:01:51 2009	(r188097)
> +++ head/lib/libc/string/memchr.c	Tue Feb  3 20:25:36 2009	(r188098)
> @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
>  #include <string.h>
>  
>  void *
> -memchr(const void *s, unsigned char c, size_t n)
> +memchr(const void *s, int c, size_t n)
>  {
>  	if (n != 0) {
>  		const unsigned char *p = s;

You just broke comparison with negative chars, as memchr(3) says:
"The memchr() function locates the first occurrence of c (converted to an
 unsigned char)"

Please change 
	if (*p++ == c)
to
	if (*p++ == (unsigned char)c)
(as in memrchr.c)

-- 
http://ache.pp.ru/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090207190418.GA336>