summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/findfp.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-02-14 05:00:20 +0000
committerpeter <peter@FreeBSD.org>2001-02-14 05:00:20 +0000
commit1c970ba5b314cd2286a5a889bb69df2bc58ed73c (patch)
tree428f8d75f4451b736a9951437789e607d623b6cc /lib/libc/stdio/findfp.c
parent9377320bfdd9e471fbc783d1a710d852acf8645a (diff)
downloadFreeBSD-src-1c970ba5b314cd2286a5a889bb69df2bc58ed73c.zip
FreeBSD-src-1c970ba5b314cd2286a5a889bb69df2bc58ed73c.tar.gz
Commit a libc fix going by the current state of the version numbering
bikeshed in -arch. It isn't quite over, but it has been well established that this can be adjusted or refined. But we do seem to have consensis on a major bump of some sort. After this, it should reasonably safe to build world again. This change is to get rid of __sF[] and use seperate __stdin/out/err handles. This means we can pad on extra bits onto the end of FILE at will without going through this all over again. __sF[] was evil because it compiled the sizeof(FILE) into every stdio using program. Asbestos suit on: check! Peril sensitive sunglasses on: check! *gulp!*
Diffstat (limited to 'lib/libc/stdio/findfp.c')
-rw-r--r--lib/libc/stdio/findfp.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/libc/stdio/findfp.c b/lib/libc/stdio/findfp.c
index f307e3e..48eb5b5 100644
--- a/lib/libc/stdio/findfp.c
+++ b/lib/libc/stdio/findfp.c
@@ -59,20 +59,21 @@ int __sdidinit;
#define NDYNAMIC 10 /* add ten more whenever necessary */
-#define std(flags, file) \
- {0,0,0,flags,file,{0},0,__sF+file,__sclose,__sread,__sseek,__swrite}
-/* p r w flags file _bf z cookie close read seek write */
+#define std(handle, flags, file) \
+FILE handle = {0,0,0,flags,file,{0},0,&handle,__sclose,__sread,__sseek,__swrite}
+/* p r w flags file _bf z cookie close read seek write */
/* the usual - (stdin + stdout + stderr) */
static FILE usual[FOPEN_MAX - 3];
static struct glue uglue = { NULL, FOPEN_MAX - 3, usual };
-FILE __sF[3] = {
- std(__SRD, STDIN_FILENO), /* stdin */
- std(__SWR, STDOUT_FILENO), /* stdout */
- std(__SWR|__SNBF, STDERR_FILENO) /* stderr */
-};
-struct glue __sglue = { &uglue, 3, __sF };
+std(__stdin, __SRD, STDIN_FILENO);
+std(__stdout, __SWR, STDOUT_FILENO);
+std(__stderr, __SWR|__SNBF, STDERR_FILENO);
+
+static struct glue sglue2 = { &uglue, 1, &__stderr };
+static struct glue sglue1 = { &sglue2, 1, &__stdout };
+struct glue __sglue = { &sglue1, 1, &__stdin };
static struct glue *lastglue = &uglue;
static struct glue * moreglue __P((int));
OpenPOWER on IntegriCloud