From 490cfb83e99515e5b5573ab74d73f15c582da1b6 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Wed, 15 Mar 2006 22:38:59 +0000 Subject: 2006-03-15 Jeff Johnston * libc/stdio/wsetup.c (__swsetup): Don't make a buffer for a string I/O file that isn't using the asprintf family. --- newlib/ChangeLog | 5 +++++ newlib/libc/stdio/wsetup.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 552742b0a..e88dcf1e4 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2006-03-15 Jeff Johnston + + * libc/stdio/wsetup.c (__swsetup): Don't make a buffer + for a string I/O file that isn't using the asprintf family. + 2006-03-07 Eric Blake * libc/stdio/freopen.c (_freopen_r) [HAVE_FCNTL]: For NULL diff --git a/newlib/libc/stdio/wsetup.c b/newlib/libc/stdio/wsetup.c index bc7299678..cf56c2abc 100644 --- a/newlib/libc/stdio/wsetup.c +++ b/newlib/libc/stdio/wsetup.c @@ -58,9 +58,11 @@ _DEFUN(__swsetup, (fp), /* * Make a buffer if necessary, then set _w. + * A string I/O file should not explicitly allocate a buffer + * unless asprintf is being used. */ - /* NOT NEEDED FOR CYGNUS SPRINTF ONLY jpg */ - if (fp->_bf._base == NULL) + if (fp->_bf._base == NULL + && (!(fp->_flags & __SSTR) || (fp->_flags & __SMBF))) __smakebuf (fp); if (fp->_flags & __SLBF) -- cgit v1.2.3