This is the mail archive of the newlib@sources.redhat.com 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]

reent fix in vfprintf


Hello. Small reentrance-related fix to make vfprintf a bit "more reentrant" is attached.

--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
Index: vfprintf.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/vfprintf.c,v
retrieving revision 1.32
diff -c -r1.32 vfprintf.c
*** vfprintf.c	3 May 2004 20:17:59 -0000	1.32
--- vfprintf.c	4 May 2004 15:10:15 -0000
***************
*** 233,240 ****
   * worries about ungetc buffers and so forth.
   */
  static int
! _DEFUN(__sbprintf, (fp, fmt, ap),
!        register FILE *fp _AND
         _CONST char *fmt  _AND
         va_list ap)
  {
--- 233,241 ----
   * worries about ungetc buffers and so forth.
   */
  static int
! _DEFUN(__sbprintf, (rptr, fp, fmt, ap),
!        struct _reent *rptr _AND
!        register FILE *fp   _AND
         _CONST char *fmt  _AND
         va_list ap)
  {
***************
*** 257,263 ****
  #endif
  
  	/* do the work, then copy any error status */
! 	ret = VFPRINTF (&fake, fmt, ap);
  	if (ret >= 0 && fflush(&fake))
  		ret = EOF;
  	if (fake._flags & __SERR)
--- 258,264 ----
  #endif
  
  	/* do the work, then copy any error status */
! 	ret = _VFPRINTF_R (rptr, &fake, fmt, ap);
  	if (ret >= 0 && fflush(&fake))
  		ret = EOF;
  	if (fake._flags & __SERR)
***************
*** 541,547 ****
  	/* optimise fprintf(stderr) (and other unbuffered Unix files) */
  	if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
  	    fp->_file >= 0)
! 		return (__sbprintf (fp, fmt0, ap));
  
  	fmt = (char *)fmt0;
  	uio.uio_iov = iovp = iov;
--- 542,548 ----
  	/* optimise fprintf(stderr) (and other unbuffered Unix files) */
  	if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
  	    fp->_file >= 0)
! 		return (__sbprintf (data, fp, fmt0, ap));
  
  	fmt = (char *)fmt0;
  	uio.uio_iov = iovp = iov;

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