use FOPEN_MAX instead of NSTATIC, _POSIX_STREAM_MAX makes it public
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Wed, 5 Jan 1994 06:43:25 +0000 (22:43 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Wed, 5 Jan 1994 06:43:25 +0000 (22:43 -0800)
SCCS-vsn: lib/libc/stdio/findfp.c 8.2

usr/src/lib/libc/stdio/findfp.c

index 165757a..131c808 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)findfp.c   8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)findfp.c   8.2 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
@@ -23,15 +23,15 @@ static char sccsid[] = "@(#)findfp.c        8.1 (Berkeley) %G%";
 
 int    __sdidinit;
 
 
 int    __sdidinit;
 
-#define NSTATIC        20      /* stdin + stdout + stderr + the usual */
-#define        NDYNAMIC 10     /* add ten more whenever necessary */
+#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(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 */
 
-static FILE usual[NSTATIC - 3];        /* the usual */
-static struct glue uglue = { 0, NSTATIC - 3, usual };
+                               /* the usual - (stdin + stdout + stderr) */
+static FILE usual[FOPEN_MAX - 3];
+static struct glue uglue = { 0, FOPEN_MAX - 3, usual };
 
 FILE __sF[3] = {
        std(__SRD, STDIN_FILENO),               /* stdin */
 
 FILE __sF[3] = {
        std(__SRD, STDIN_FILENO),               /* stdin */
@@ -103,9 +103,10 @@ found:
  */
 f_prealloc()
 {
  */
 f_prealloc()
 {
-       int n = getdtablesize() - NSTATIC + 20;         /* 20 for slop */
        register struct glue *g;
        register struct glue *g;
+       int n;
 
 
+       n = getdtablesize() - FOPEN_MAX + 20;           /* 20 for slop. */
        for (g = &__sglue; (n -= g->niobs) > 0 && g->next; g = g->next)
                /* void */;
        if (n > 0)
        for (g = &__sglue; (n -= g->niobs) > 0 && g->next; g = g->next)
                /* void */;
        if (n > 0)