about summary refs log tree commit diff
path: root/src/stdio
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-04-18 14:46:05 -0400
committerRich Felker <dalias@aerifal.cx>2018-04-18 14:46:05 -0400
commit4245a233c147e18a841bc6ccd5aafb65d6bca163 (patch)
tree033922de5f4fc1e1b10f08b6b5741b1205ff4db3 /src/stdio
parentc9f415d7ea2dace5bf77f6518b6afc36bb7a5732 (diff)
downloadmusl-4245a233c147e18a841bc6ccd5aafb65d6bca163.tar.gz
musl-4245a233c147e18a841bc6ccd5aafb65d6bca163.tar.xz
musl-4245a233c147e18a841bc6ccd5aafb65d6bca163.zip
minor cleanup in fopencookie
assign entire struct rather than member-at-a-time. don't repeat buffer
sizes; always use sizeof to ensure consistency.
Diffstat (limited to 'src/stdio')
-rw-r--r--src/stdio/fopencookie.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/stdio/fopencookie.c b/src/stdio/fopencookie.c
index 2f46dd53..da042fe8 100644
--- a/src/stdio/fopencookie.c
+++ b/src/stdio/fopencookie.c
@@ -116,15 +116,12 @@ FILE *fopencookie(void *cookie, const char *mode, cookie_io_functions_t iofuncs)
 
 	/* Set up our fcookie */
 	f->fc.cookie = cookie;
-	f->fc.iofuncs.read = iofuncs.read;
-	f->fc.iofuncs.write = iofuncs.write;
-	f->fc.iofuncs.seek = iofuncs.seek;
-	f->fc.iofuncs.close = iofuncs.close;
+	f->fc.iofuncs = iofuncs;
 
 	f->f.fd = -1;
 	f->f.cookie = &f->fc;
 	f->f.buf = f->buf + UNGET;
-	f->f.buf_size = BUFSIZ;
+	f->f.buf_size = sizeof f->buf - UNGET;
 	f->f.lbf = EOF;
 
 	/* Initialize op ptrs. No problem if some are unneeded. */