This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: _REENT_SMALL IO broken


Attached is the patch I have been testing. It seems to do the trick. If you want to test it out a bit further, let me know, otherwise, I'll commit it.

BTW: you were right about the feof, clearerr, and ferror macros. I changed stdio.h to force them to be functions.

-- Jeff J.

Jeff Johnston wrote:
Paul Brook wrote:

_REENT_SMALL was specifically added for embedded platforms that are
extremely tight on storage (some verging on crippled IMO).  It should
not be used by platforms that just want to save a few bytes.  It is not
surprising that these platforms can't do everything in a Standard's test
bucket (some of them don't even do file I/O).  Storing away the standard
streams isn't something any reasonable program other than a concocted
standard-test is going to do.  It certainly won't be found in real code
written for such platforms.



My interest here is for armv7. This covers everything from tiny microcontrollers with only 2k ram to large SoC systems many megabytes of memory. It'd be nice to be able to use the same library for both.


Comparing a file pointer to stdin does occur in real code. For example gdb contains several instances of "if (instream == stdin)".


Granted, but gdb is not going to run on a _REENT_SMALL platform and such a problem is solved by adding a first reference (e.g. fflush(stdin)). _REENT_SMALL platform code makes concessions as needed. I think the answer in this situation is to add another macro to control whether the FILE structs are found in the small reent struct or not (default no). This will solve your problem and won't interfere with existing _REENT_SMALL builds.



There are also more subtle bugs that can occur when using the dummy FILE*
with the feof, ferror, and clearerr macros.


These macros should be ok.  You shouldn't be at EOF since you haven't
issued any read and you haven't caused any error to occur prior to the
first reference.



The user could still be using the old value via a cached pointer, as in my previous example or more commonly by stdout being passed as a function argument. This is definitely fairly common practice. eg:


void frob(FILE *f)
{
 while (!feof(f))
  fgetc(f);
}
int main()
{
 frob(stdin);
 return 0;
}

It's arguable whether it's ok to change the value of stdin, but if it does change then the old pointer must continue to function correctly.


Yes, you are right. I have incorporated this feature into my patch which I am currently testing.


-- Jeff J.


Index: libc/include/stdio.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/stdio.h,v
retrieving revision 1.37
diff -u -p -r1.37 stdio.h
--- libc/include/stdio.h	15 Jun 2006 16:08:09 -0000	1.37
+++ libc/include/stdio.h	26 Sep 2006 20:21:53 -0000
@@ -455,9 +455,11 @@ static __inline int __sputc_r(struct _re
 #define	__sclearerr(p)	((void)((p)->_flags &= ~(__SERR|__SEOF)))
 #define	__sfileno(p)	((p)->_file)
 
+#ifndef _REENT_SMALL
 #define	feof(p)		__sfeof(p)
 #define	ferror(p)	__sferror(p)
 #define	clearerr(p)	__sclearerr(p)
+#endif
 
 #if 0 /*ndef __STRICT_ANSI__ - FIXME: must initialize stdio first, use fn */
 #define	fileno(p)	__sfileno(p)
Index: libc/include/sys/reent.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/reent.h,v
retrieving revision 1.35
diff -u -p -r1.35 reent.h
--- libc/include/sys/reent.h	22 Sep 2006 19:33:11 -0000	1.35
+++ libc/include/sys/reent.h	26 Sep 2006 20:21:53 -0000
@@ -13,6 +13,8 @@ extern "C" {
 #include <_ansi.h>
 #include <sys/_types.h>
 
+#define _NULL 0
+
 #ifndef __Long
 #if __LONG_MAX__ == 2147483647L
 #define __Long long
@@ -157,8 +159,8 @@ struct __sFILE_fake {
 
   struct _reent *_data;
 };
-/* CHECK_INIT() comes from stdio/local.h; be sure to include that.  */
-# define _REENT_SMALL_CHECK_INIT(ptr) CHECK_INIT(ptr)
+/* CHECK_STD_INIT() comes from stdio/local.h; be sure to include that.  */
+# define _REENT_SMALL_CHECK_INIT(ptr) CHECK_STD_INIT(ptr)
 #else
 # define _REENT_SMALL_CHECK_INIT(ptr) /* nothing */
 #endif
@@ -382,15 +384,18 @@ struct _reent
 
   struct _glue __sglue;			/* root of glue chain */
   __FILE *__sf;			        /* file descriptors */
-  struct __sFILE_fake __sf_fake;	/* fake initial stdin/out/err */
   struct _misc_reent *_misc;            /* strtok, multibyte states */
   char *_signal_buf;                    /* strsignal */
 };
 
+extern const struct __sFILE_fake __sf_fake_stdin;
+extern const struct __sFILE_fake __sf_fake_stdout;
+extern const struct __sFILE_fake __sf_fake_stderr;
+
 #define _REENT_INIT(var) \
-  { (__FILE *)&var.__sf_fake, \
-    (__FILE *)&var.__sf_fake, \
-    (__FILE *)&var.__sf_fake, \
+  { (__FILE *)&__sf_fake_stdin, \
+    (__FILE *)&__sf_fake_stdout, \
+    (__FILE *)&__sf_fake_stderr, \
     0, \
     0, \
     _NULL, \
@@ -410,15 +415,14 @@ struct _reent
     {_NULL, 0, {_NULL}, _NULL}, \
     {_NULL, 0, _NULL}, \
     _NULL, \
-    {_NULL, 0, 0, 0, 0, {_NULL, 0}, 0, _NULL}, \
     _NULL, \
     _NULL \
   }
 
 #define _REENT_INIT_PTR(var) \
-  { var->_stdin = (__FILE *)&var->__sf_fake; \
-    var->_stdout = (__FILE *)&var->__sf_fake; \
-    var->_stderr = (__FILE *)&var->__sf_fake; \
+  { var->_stdin = (__FILE *)&__sf_fake_stdin; \
+    var->_stdout = (__FILE *)&__sf_fake_stdout; \
+    var->_stderr = (__FILE *)&__sf_fake_stderr; \
     var->_errno = 0; \
     var->_inc = 0; \
     var->_emergency = _NULL; \
@@ -443,15 +447,6 @@ struct _reent
     var->__sglue._niobs = 0; \
     var->__sglue._iobs = _NULL; \
     var->__sf = 0; \
-    var->__sf_fake._p = _NULL; \
-    var->__sf_fake._r = 0; \
-    var->__sf_fake._w = 0; \
-    var->__sf_fake._flags = 0; \
-    var->__sf_fake._file = 0; \
-    var->__sf_fake._bf._base = _NULL; \
-    var->__sf_fake._bf._size = 0; \
-    var->__sf_fake._lbfsize = 0; \
-    var->__sf_fake._data = _NULL; \
     var->_misc = _NULL; \
     var->_signal_buf = _NULL; \
   }
@@ -786,8 +781,6 @@ struct _reent
 
 #endif /* !_REENT_SMALL */
 
-#define _NULL 0
-
 /*
  * All references to struct _reent are via this pointer.
  * Internally, newlib routines that need to reference it should use _REENT.
Index: libc/machine/powerpc/vfprintf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/powerpc/vfprintf.c,v
retrieving revision 1.11
diff -u -p -r1.11 vfprintf.c
--- libc/machine/powerpc/vfprintf.c	8 Feb 2005 01:33:16 -0000	1.11
+++ libc/machine/powerpc/vfprintf.c	26 Sep 2006 20:21:53 -0000
@@ -321,7 +321,7 @@ _DEFUN (VFPRINTF, (fp, fmt0, ap),
 	_CONST char *fmt0 _AND
 	va_list ap)
 {
-  CHECK_INIT (_REENT);
+  CHECK_INIT (_REENT, fp);
   return _VFPRINTF_R (_REENT, fp, fmt0, ap);
 }
 
@@ -875,7 +875,9 @@ reswitch:	switch (ch) {
 					if (prec || flags & ALT)
 						size += prec + 1;
 				} else	/* "0.X" */
-					size = prec + 2;
+                                        size = (prec || flags & ALT)
+                                                  ? prec + 2
+                                                  : 1;
 			} else if (expt >= ndig) {	/* fixed g fmt */
 				size = expt;
 				if (flags & ALT)
Index: libc/machine/powerpc/vfscanf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/machine/powerpc/vfscanf.c,v
retrieving revision 1.15
diff -u -p -r1.15 vfscanf.c
--- libc/machine/powerpc/vfscanf.c	8 Feb 2005 01:33:16 -0000	1.15
+++ libc/machine/powerpc/vfscanf.c	26 Sep 2006 20:21:53 -0000
@@ -224,7 +224,7 @@ _DEFUN (vfscanf, (fp, fmt, ap), 
     _CONST char *fmt _AND 
     va_list ap)
 {
-  CHECK_INIT(_REENT);
+  CHECK_INIT(_REENT, fp);
   return __svfscanf_r (_REENT, fp, fmt, ap);
 }
 
Index: libc/stdio/clearerr.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/clearerr.c,v
retrieving revision 1.4
diff -u -p -r1.4 clearerr.c
--- libc/stdio/clearerr.c	8 Feb 2005 01:33:16 -0000	1.4
+++ libc/stdio/clearerr.c	26 Sep 2006 20:21:53 -0000
@@ -64,7 +64,7 @@ _VOID
 _DEFUN(clearerr, (fp),
        FILE * fp)
 {
-  CHECK_INIT(_REENT);
+  CHECK_INIT(_REENT, fp);
   _flockfile (fp);
   __sclearerr (fp);
   _funlockfile (fp);
Index: libc/stdio/fclose.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fclose.c,v
retrieving revision 1.10
diff -u -p -r1.10 fclose.c
--- libc/stdio/fclose.c	8 Feb 2005 01:33:16 -0000	1.10
+++ libc/stdio/fclose.c	26 Sep 2006 20:21:53 -0000
@@ -76,7 +76,7 @@ _DEFUN(_fclose_r, (rptr, fp),
 
   __sfp_lock_acquire ();
 
-  CHECK_INIT (rptr);
+  CHECK_INIT (rptr, fp);
 
   _flockfile (fp);
   
Index: libc/stdio/feof.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/feof.c,v
retrieving revision 1.4
diff -u -p -r1.4 feof.c
--- libc/stdio/feof.c	8 Feb 2005 01:33:16 -0000	1.4
+++ libc/stdio/feof.c	26 Sep 2006 20:21:53 -0000
@@ -57,7 +57,7 @@ _DEFUN(feof, (fp),
        FILE * fp)
 {
   int result;
-  CHECK_INIT(_REENT);
+  CHECK_INIT(_REENT, fp);
   _flockfile (fp);
   result = __sfeof (fp);
   _funlockfile (fp);
Index: libc/stdio/ferror.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/ferror.c,v
retrieving revision 1.4
diff -u -p -r1.4 ferror.c
--- libc/stdio/ferror.c	8 Feb 2005 01:33:16 -0000	1.4
+++ libc/stdio/ferror.c	26 Sep 2006 20:21:53 -0000
@@ -66,7 +66,7 @@ _DEFUN(ferror, (fp),
        FILE * fp)
 {
   int result;
-  CHECK_INIT(_REENT);
+  CHECK_INIT(_REENT, fp);
   _flockfile (fp);
   result = __sferror (fp);
   _funlockfile (fp);
Index: libc/stdio/fflush.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fflush.c,v
retrieving revision 1.6
diff -u -p -r1.6 fflush.c
--- libc/stdio/fflush.c	20 Feb 2006 23:24:00 -0000	1.6
+++ libc/stdio/fflush.c	26 Sep 2006 20:21:53 -0000
@@ -67,7 +67,7 @@ _DEFUN(fflush, (fp),
   if (fp == NULL)
     return _fwalk (_GLOBAL_REENT, fflush);
 
-  CHECK_INIT (_REENT);
+  CHECK_INIT (_REENT, fp);
 
   _flockfile (fp);
 
Index: libc/stdio/fgetc.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fgetc.c,v
retrieving revision 1.5
diff -u -p -r1.5 fgetc.c
--- libc/stdio/fgetc.c	14 Jun 2006 20:49:11 -0000	1.5
+++ libc/stdio/fgetc.c	26 Sep 2006 20:21:53 -0000
@@ -77,7 +77,7 @@ _DEFUN(_fgetc_r, (ptr, fp),
        FILE * fp)
 {
   int result;
-  CHECK_INIT(ptr);
+  CHECK_INIT(ptr, fp);
   _flockfile (fp);
   result = __sgetc_r (ptr, fp);
   _funlockfile (fp);
@@ -92,7 +92,7 @@ _DEFUN(fgetc, (fp),
 {
 #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
   int result;
-  CHECK_INIT(_REENT);
+  CHECK_INIT(_REENT, fp);
   _flockfile (fp);
   result = __sgetc_r (_REENT, fp);
   _funlockfile (fp);
Index: libc/stdio/fgets.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fgets.c,v
retrieving revision 1.6
diff -u -p -r1.6 fgets.c
--- libc/stdio/fgets.c	14 Jun 2006 20:49:11 -0000	1.6
+++ libc/stdio/fgets.c	26 Sep 2006 20:21:53 -0000
@@ -96,7 +96,7 @@ _DEFUN(_fgets_r, (ptr, buf, n, fp),
 
   s = buf;
 
-  CHECK_INIT(ptr);
+  CHECK_INIT(ptr, fp);
 
   _flockfile (fp);
 #ifdef __SCLE
Index: libc/stdio/fileno.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fileno.c,v
retrieving revision 1.4
diff -u -p -r1.4 fileno.c
--- libc/stdio/fileno.c	8 Feb 2005 01:33:16 -0000	1.4
+++ libc/stdio/fileno.c	26 Sep 2006 20:21:53 -0000
@@ -54,7 +54,7 @@ _DEFUN(fileno, (f),
        FILE * f)
 {
   int result;
-  CHECK_INIT (_REENT);
+  CHECK_INIT (_REENT, f);
   _flockfile (f);
   result = __sfileno (f);
   _funlockfile (f);
Index: libc/stdio/findfp.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/findfp.c,v
retrieving revision 1.16
diff -u -p -r1.16 findfp.c
--- libc/stdio/findfp.c	8 Feb 2005 01:05:50 -0000	1.16
+++ libc/stdio/findfp.c	26 Sep 2006 20:21:53 -0000
@@ -26,6 +26,15 @@
 #include <sys/lock.h>
 #include "local.h"
 
+#ifdef _REENT_SMALL
+const struct __sFILE_fake __sf_fake_stdin =
+    {_NULL, 0, 0, 0, 0, {_NULL, 0}, 0, _NULL};
+const struct __sFILE_fake __sf_fake_stdout =
+    {_NULL, 0, 0, 0, 0, {_NULL, 0}, 0, _NULL};
+const struct __sFILE_fake __sf_fake_stderr =
+    {_NULL, 0, 0, 0, 0, {_NULL, 0}, 0, _NULL};
+#endif
+
 static _VOID
 _DEFUN(std, (ptr, flags, file, data),
             FILE *ptr _AND
Index: libc/stdio/fputc.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fputc.c,v
retrieving revision 1.5
diff -u -p -r1.5 fputc.c
--- libc/stdio/fputc.c	14 Jun 2006 20:49:11 -0000	1.5
+++ libc/stdio/fputc.c	26 Sep 2006 20:21:53 -0000
@@ -82,7 +82,7 @@ _DEFUN(_fputc_r, (ptr, ch, file),
        FILE * file)
 {
   int result;
-  CHECK_INIT(ptr);
+  CHECK_INIT(ptr, file);
    _flockfile (file);
   result = _putc_r (ptr, ch, file);
   _funlockfile (file);
@@ -97,7 +97,7 @@ _DEFUN(fputc, (ch, file),
 {
 #if !defined(__OPTIMIZE_SIZE__) && !defined(PREFER_SIZE_OVER_SPEED)
   int result;
-  CHECK_INIT(_REENT);
+  CHECK_INIT(_REENT, file);
    _flockfile (file);
   result = _putc_r (_REENT, ch, file);
   _funlockfile (file);
Index: libc/stdio/fputs.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fputs.c,v
retrieving revision 1.5
diff -u -p -r1.5 fputs.c
--- libc/stdio/fputs.c	14 Jun 2006 20:49:11 -0000	1.5
+++ libc/stdio/fputs.c	26 Sep 2006 20:21:53 -0000
@@ -86,7 +86,7 @@ _DEFUN(_fputs_r, (ptr, s, fp),
   uio.uio_iov = &iov;
   uio.uio_iovcnt = 1;
 
-  CHECK_INIT(ptr);
+  CHECK_INIT(ptr, fp);
 
   _flockfile (fp);
   result = __sfvwrite_r (ptr, fp, &uio);
Index: libc/stdio/fread.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fread.c,v
retrieving revision 1.12
diff -u -p -r1.12 fread.c
--- libc/stdio/fread.c	15 Jun 2006 16:08:09 -0000	1.12
+++ libc/stdio/fread.c	26 Sep 2006 20:21:53 -0000
@@ -145,7 +145,7 @@ _DEFUN(_fread_r, (ptr, buf, size, count,
   if ((resid = count * size) == 0)
     return 0;
 
-  CHECK_INIT(ptr);
+  CHECK_INIT(ptr, fp);
 
   _flockfile (fp);
   if (fp->_r < 0)
Index: libc/stdio/freopen.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/freopen.c,v
retrieving revision 1.17
diff -u -p -r1.17 freopen.c
--- libc/stdio/freopen.c	29 Mar 2006 21:57:20 -0000	1.17
+++ libc/stdio/freopen.c	26 Sep 2006 20:21:53 -0000
@@ -99,7 +99,7 @@ _DEFUN(_freopen_r, (ptr, file, mode, fp)
 
   __sfp_lock_acquire ();
 
-  CHECK_INIT (ptr);
+  CHECK_INIT (ptr, fp);
 
   _flockfile (fp);
 
Index: libc/stdio/fseek.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fseek.c,v
retrieving revision 1.13
diff -u -p -r1.13 fseek.c
--- libc/stdio/fseek.c	14 Jun 2006 20:49:11 -0000	1.13
+++ libc/stdio/fseek.c	26 Sep 2006 20:21:53 -0000
@@ -131,7 +131,7 @@ _DEFUN(_fseek_r, (ptr, fp, offset, whenc
 
   /* Make sure stdio is set up.  */
 
-  CHECK_INIT (ptr);
+  CHECK_INIT (ptr, fp);
 
   _flockfile (fp);
 
Index: libc/stdio/ftell.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/ftell.c,v
retrieving revision 1.9
diff -u -p -r1.9 ftell.c
--- libc/stdio/ftell.c	8 Feb 2005 01:33:16 -0000	1.9
+++ libc/stdio/ftell.c	26 Sep 2006 20:21:53 -0000
@@ -107,7 +107,7 @@ _DEFUN(_ftell_r, (ptr, fp),
 
   /* Ensure stdio is set up.  */
 
-  CHECK_INIT (ptr);
+  CHECK_INIT (ptr, fp);
 
   _flockfile (fp);
 
Index: libc/stdio/fwrite.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fwrite.c,v
retrieving revision 1.6
diff -u -p -r1.6 fwrite.c
--- libc/stdio/fwrite.c	1 Aug 2006 20:20:25 -0000	1.6
+++ libc/stdio/fwrite.c	26 Sep 2006 20:21:53 -0000
@@ -117,7 +117,7 @@ _DEFUN(_fwrite_r, (ptr, buf, size, count
    * generally slow and since this occurs whenever size==0.
    */
 
-  CHECK_INIT(ptr);
+  CHECK_INIT(ptr, fp);
 
   _flockfile (fp);
   if (__sfvwrite_r (ptr, fp, &uio) == 0)
Index: libc/stdio/getc.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/getc.c,v
retrieving revision 1.5
diff -u -p -r1.5 getc.c
--- libc/stdio/getc.c	14 Jun 2006 20:49:11 -0000	1.5
+++ libc/stdio/getc.c	26 Sep 2006 20:21:53 -0000
@@ -91,7 +91,7 @@ _DEFUN(_getc_r, (ptr, fp),
        register FILE *fp)
 {
   int result;
-  CHECK_INIT (ptr);
+  CHECK_INIT (ptr, fp);
   _flockfile (fp);
   result = __sgetc_r (ptr, fp);
   _funlockfile (fp);
@@ -105,7 +105,7 @@ _DEFUN(getc, (fp),
        register FILE *fp)
 {
   int result;
-  CHECK_INIT (_REENT);
+  CHECK_INIT (_REENT, fp);
   _flockfile (fp);
   result = __sgetc_r (_REENT, fp);
   _funlockfile (fp);
Index: libc/stdio/getdelim.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/getdelim.c,v
retrieving revision 1.5
diff -u -p -r1.5 getdelim.c
--- libc/stdio/getdelim.c	28 Oct 2005 21:21:07 -0000	1.5
+++ libc/stdio/getdelim.c	26 Sep 2006 20:21:53 -0000
@@ -79,7 +79,7 @@ _DEFUN(__getdelim, (bufptr, n, delim, fp
       *n = DEFAULT_LINE_SIZE;
     }
 
-  CHECK_INIT (_REENT);
+  CHECK_INIT (_REENT, fp);
 
   _flockfile (fp);
 
Index: libc/stdio/local.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/local.h,v
retrieving revision 1.17
diff -u -p -r1.17 local.h
--- libc/stdio/local.h	14 Jun 2006 20:49:11 -0000	1.17
+++ libc/stdio/local.h	26 Sep 2006 20:21:53 -0000
@@ -48,7 +48,31 @@ struct _glue * _EXFUN(__sfmoreglue,(stru
 
 /* Called by the main entry point fns to ensure stdio has been initialized.  */
 
-#define CHECK_INIT(ptr) \
+#ifdef _REENT_SMALL
+#define CHECK_INIT(ptr, fp) \
+  do						\
+    {						\
+      if ((ptr) && !(ptr)->__sdidinit)		\
+	__sinit (ptr);				\
+      if ((fp) == (FILE *)&__sf_fake_stdin)	\
+	(fp) = stdin;				\
+      else if ((fp) == (FILE *)&__sf_fake_stdout) \
+	(fp) = stdout;				\
+      else if ((fp) == (FILE *)&__sf_fake_stderr) \
+	(fp) = stderr;				\
+    }						\
+  while (0)
+#else /* !_REENT_SMALL   */
+#define CHECK_INIT(ptr, fp) \
+  do						\
+    {						\
+      if ((ptr) && !(ptr)->__sdidinit)		\
+	__sinit (ptr);				\
+    }						\
+  while (0)
+#endif /* !_REENT_SMALL  */
+
+#define CHECK_STD_INIT(ptr) \
   do						\
     {						\
       if ((ptr) && !(ptr)->__sdidinit)		\
Index: libc/stdio/putc.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/putc.c,v
retrieving revision 1.5
diff -u -p -r1.5 putc.c
--- libc/stdio/putc.c	14 Jun 2006 20:49:11 -0000	1.5
+++ libc/stdio/putc.c	26 Sep 2006 20:21:53 -0000
@@ -96,7 +96,7 @@ _DEFUN(_putc_r, (ptr, c, fp),
        register FILE *fp)
 {
   int result;
-  CHECK_INIT (ptr);
+  CHECK_INIT (ptr, fp);
   _flockfile (fp);
   result = __sputc_r (ptr, c, fp);
   _funlockfile (fp);
@@ -111,7 +111,7 @@ _DEFUN(putc, (c, fp),
 {
 #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
   int result;
-  CHECK_INIT (_REENT);
+  CHECK_INIT (_REENT, fp);
   _flockfile (fp);
   result = __sputc_r (_REENT, c, fp);
   _funlockfile (fp);
Index: libc/stdio/refill.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/refill.c,v
retrieving revision 1.7
diff -u -p -r1.7 refill.c
--- libc/stdio/refill.c	14 Jun 2006 20:49:11 -0000	1.7
+++ libc/stdio/refill.c	26 Sep 2006 20:21:53 -0000
@@ -43,7 +43,7 @@ _DEFUN(__srefill_r, (ptr, fp),
 {
   /* make sure stdio is set up */
 
-  CHECK_INIT (_REENT);
+  CHECK_INIT (_REENT, fp);
 
   fp->_r = 0;			/* largely a convenience for callers */
 
Index: libc/stdio/setvbuf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/setvbuf.c,v
retrieving revision 1.5
diff -u -p -r1.5 setvbuf.c
--- libc/stdio/setvbuf.c	8 Feb 2005 01:33:17 -0000	1.5
+++ libc/stdio/setvbuf.c	26 Sep 2006 20:21:53 -0000
@@ -104,7 +104,7 @@ _DEFUN(setvbuf, (fp, buf, mode, size),
 {
   int ret = 0;
 
-  CHECK_INIT (_REENT);
+  CHECK_INIT (_REENT, fp);
 
   _flockfile (fp);
 
Index: libc/stdio/ungetc.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/ungetc.c,v
retrieving revision 1.6
diff -u -p -r1.6 ungetc.c
--- libc/stdio/ungetc.c	8 Feb 2005 01:33:17 -0000	1.6
+++ libc/stdio/ungetc.c	26 Sep 2006 20:21:53 -0000
@@ -81,7 +81,7 @@ _DEFUN(_ungetc_r, (rptr, c, fp),
      ??? Might be able to remove this as some other stdio routine should
      have already been called to get the char we are un-getting.  */
 
-  CHECK_INIT (rptr);
+  CHECK_INIT (rptr, fp);
 
   _flockfile (fp);
   
Index: libc/stdio/vfprintf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/vfprintf.c,v
retrieving revision 1.45
diff -u -p -r1.45 vfprintf.c
--- libc/stdio/vfprintf.c	6 Sep 2006 20:03:27 -0000	1.45
+++ libc/stdio/vfprintf.c	26 Sep 2006 20:21:53 -0000
@@ -540,7 +540,7 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap)
 	    (u_long)GET_ARG (N, ap, u_int))
 #endif
 
-	CHECK_INIT (data);
+	CHECK_INIT (data, fp);
 	_flockfile (fp);
 
 	/* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
Index: libc/stdio/vfscanf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/vfscanf.c,v
retrieving revision 1.32
diff -u -p -r1.32 vfscanf.c
--- libc/stdio/vfscanf.c	14 Jun 2006 20:49:11 -0000	1.32
+++ libc/stdio/vfscanf.c	26 Sep 2006 20:21:53 -0000
@@ -231,7 +231,7 @@ _DEFUN(VFSCANF, (fp, fmt, ap), 
        _CONST char *fmt _AND 
        va_list ap)
 {
-  CHECK_INIT(_REENT);
+  CHECK_INIT(_REENT, fp);
   return __SVFSCANF_R (_REENT, fp, fmt, ap);
 }
 
@@ -253,7 +253,7 @@ _DEFUN(_VFSCANF_R, (data, fp, fmt, ap),
        _CONST char *fmt    _AND 
        va_list ap)
 {
-  CHECK_INIT(data);
+  CHECK_INIT(data, fp);
   return __SVFSCANF_R (data, fp, fmt, ap);
 }
 
Index: libc/stdio/wbuf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/wbuf.c,v
retrieving revision 1.5
diff -u -p -r1.5 wbuf.c
--- libc/stdio/wbuf.c	15 Jun 2006 16:08:09 -0000	1.5
+++ libc/stdio/wbuf.c	26 Sep 2006 20:21:53 -0000
@@ -42,7 +42,7 @@ _DEFUN(__swbuf_r, (ptr, c, fp),
 
   /* Ensure stdio has been initialized.  */
 
-  CHECK_INIT (ptr);
+  CHECK_INIT (ptr, fp);
 
   /*
    * In case we cannot write, or longjmp takes us out early,
Index: libc/stdio/wsetup.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/wsetup.c,v
retrieving revision 1.4
diff -u -p -r1.4 wsetup.c
--- libc/stdio/wsetup.c	15 Mar 2006 22:38:59 -0000	1.4
+++ libc/stdio/wsetup.c	26 Sep 2006 20:21:53 -0000
@@ -34,7 +34,7 @@ _DEFUN(__swsetup, (fp),
 {
   /* Make sure stdio is set up.  */
 
-  CHECK_INIT (_REENT);
+  CHECK_INIT (_REENT, fp);
 
   /*
    * If we are not writing, we had better be reading and writing.
Index: libc/stdio64/freopen64.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio64/freopen64.c,v
retrieving revision 1.12
diff -u -p -r1.12 freopen64.c
--- libc/stdio64/freopen64.c	29 Mar 2006 21:57:21 -0000	1.12
+++ libc/stdio64/freopen64.c	26 Sep 2006 20:21:53 -0000
@@ -99,7 +99,7 @@ _DEFUN (_freopen64_r, (ptr, file, mode, 
 
   __sfp_lock_acquire ();
 
-  CHECK_INIT (ptr);
+  CHECK_INIT (ptr, fp);
 
   _flockfile(fp);
 
Index: libc/stdio64/fseeko64.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio64/fseeko64.c,v
retrieving revision 1.7
diff -u -p -r1.7 fseeko64.c
--- libc/stdio64/fseeko64.c	14 Jun 2006 20:49:11 -0000	1.7
+++ libc/stdio64/fseeko64.c	26 Sep 2006 20:21:53 -0000
@@ -113,7 +113,7 @@ _DEFUN (_fseeko64_r, (ptr, fp, offset, w
 
   /* Make sure stdio is set up.  */
 
-  CHECK_INIT (ptr);
+  CHECK_INIT (ptr, fp);
 
   _flockfile(fp);
 
Index: libc/stdio64/ftello64.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio64/ftello64.c,v
retrieving revision 1.4
diff -u -p -r1.4 ftello64.c
--- libc/stdio64/ftello64.c	8 Feb 2005 01:33:17 -0000	1.4
+++ libc/stdio64/ftello64.c	26 Sep 2006 20:21:53 -0000
@@ -93,7 +93,7 @@ _DEFUN (_ftello64_r, (ptr, fp),
 
   /* Ensure stdio is set up.  */
 
-  CHECK_INIT (ptr);
+  CHECK_INIT (ptr, fp);
 
   _flockfile(fp);
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]