From ed68431e9eb5f5d79436afe779c4564cc625c69e Mon Sep 17 00:00:00 2001 From: emaste Date: Tue, 23 Apr 2013 14:36:44 +0000 Subject: Convert libc/stdio from K&R to ANSI C And add '__restrict' where it appeared in the header prototypes --- lib/libc/stdio/stdio.c | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) (limited to 'lib/libc/stdio/stdio.c') diff --git a/lib/libc/stdio/stdio.c b/lib/libc/stdio/stdio.c index b02fa5d..44ee0ab 100644 --- a/lib/libc/stdio/stdio.c +++ b/lib/libc/stdio/stdio.c @@ -50,10 +50,7 @@ __FBSDID("$FreeBSD$"); * Small standard I/O/seek/close functions. */ int -__sread(cookie, buf, n) - void *cookie; - char *buf; - int n; +__sread(void *cookie, char *buf, int n) { FILE *fp = cookie; @@ -61,10 +58,7 @@ __sread(cookie, buf, n) } int -__swrite(cookie, buf, n) - void *cookie; - char const *buf; - int n; +__swrite(void *cookie, char const *buf, int n) { FILE *fp = cookie; @@ -72,10 +66,7 @@ __swrite(cookie, buf, n) } fpos_t -__sseek(cookie, offset, whence) - void *cookie; - fpos_t offset; - int whence; +__sseek(void *cookie, fpos_t offset, int whence) { FILE *fp = cookie; @@ -83,8 +74,7 @@ __sseek(cookie, offset, whence) } int -__sclose(cookie) - void *cookie; +__sclose(void *cookie) { return (_close(((FILE *)cookie)->_file)); @@ -94,10 +84,7 @@ __sclose(cookie) * Higher level wrappers. */ int -_sread(fp, buf, n) - FILE *fp; - char *buf; - int n; +_sread(FILE *fp, char *buf, int n) { int ret; @@ -115,10 +102,7 @@ _sread(fp, buf, n) } int -_swrite(fp, buf, n) - FILE *fp; - char const *buf; - int n; +_swrite(FILE *fp, char const *buf, int n) { int ret; int serrno; @@ -145,10 +129,7 @@ _swrite(fp, buf, n) } fpos_t -_sseek(fp, offset, whence) - FILE *fp; - fpos_t offset; - int whence; +_sseek(FILE *fp, fpos_t offset, int whence) { fpos_t ret; int serrno, errret; -- cgit v1.1