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.
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"