Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 07 Feb 2009 12:32:53 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        ache@nagual.pp.ru
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:  <20090207.123253.-1775864766.imp@bsdimp.com>
In-Reply-To: <20090207190418.GA336@nagual.pp.ru>
References:  <200902032025.n13KPaCV041012@svn.freebsd.org> <20090207190418.GA336@nagual.pp.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20090207190418.GA336@nagual.pp.ru>
            Andrey Chernov <ache@nagual.pp.ru> writes:
: 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)

Yes.  Thanks.

Warner



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