svn commit: r188098 - head/lib/libc/string

M. Warner Losh imp at bsdimp.com
Sat Feb 7 11:33:14 PST 2009


In message: <20090207190418.GA336 at nagual.pp.ru>
            Andrey Chernov <ache at 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


More information about the svn-src-all mailing list