Date: Tue, 03 Feb 2009 21:28:40 +0100 From: Christoph Mallon <christoph.mallon@gmx.de> To: Daniel Gerzo <danger@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r188080 - head/lib/libc/string Message-ID: <4988A8F8.9050409@gmx.de> In-Reply-To: <200902031758.n13HwKHT037144@svn.freebsd.org> References: <200902031758.n13HwKHT037144@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Daniel Gerzo schrieb: > Author: danger (doc committer) > Date: Tue Feb 3 17:58:20 2009 > New Revision: 188080 > URL: http://svn.freebsd.org/changeset/base/188080 > > Log: > - ANSIfy function definitions > - use nul when we are looking for a terminating character where appropriate > > Approved by: imp [...] > Modified: head/lib/libc/string/memchr.c > ============================================================================== > --- head/lib/libc/string/memchr.c Tue Feb 3 17:13:37 2009 (r188079) > +++ head/lib/libc/string/memchr.c Tue Feb 3 17:58:20 2009 (r188080) > @@ -39,10 +39,7 @@ __FBSDID("$FreeBSD$"); > #include <string.h> > > void * > -memchr(s, c, n) > - const void *s; > - unsigned char c; > - size_t n; > +memchr(const void *s, unsigned char c, size_t n) > { > if (n != 0) { > const unsigned char *p = s; K&R style function definitions work slightly different than ANSI. void f(x) char x; {} fits to the prototype declaration void f(int x); int in the prototype because it has to fit to the default promoted type of the parameter of the K&R function definition! So just moving types < int from the K&R declaration list into the parameter list will break things (as it does here with memchr(), because the prototype declaration correctly uses type int). Conversely void g(char x); void g(x) char x; {} are NOT compatible, but GCC incorrectly accepts this.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4988A8F8.9050409>