svn commit: r188098 - head/lib/libc/string
Andrey Chernov
ache at nagual.pp.ru
Sat Feb 7 11:17:11 PST 2009
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/
More information about the svn-src-head
mailing list