From 7d794364439c77f23403eaa09169ca8884bfe091 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 30 Nov 2006 00:35:57 +0000 Subject: 2006-11-29 Jeff Johnston * libc/stdio/makebuf.c (__smakebuf): If dealing with an asprintf-family buffer, make the default initial size 64. --- newlib/ChangeLog | 5 +++++ newlib/libc/stdio/makebuf.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index ff9f034e2..cab8db24e 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2006-11-29 Jeff Johnston + + * libc/stdio/makebuf.c (__smakebuf): If dealing with + an asprintf-family buffer, make the default initial size 64. + 2006-11-29 Eric Blake * libc/stdio/fvwrite.c (__sfvwrite_r): Avoid off-by-one error in diff --git a/newlib/libc/stdio/makebuf.c b/newlib/libc/stdio/makebuf.c index c4d03ecb6..9808cd5ec 100644 --- a/newlib/libc/stdio/makebuf.c +++ b/newlib/libc/stdio/makebuf.c @@ -24,6 +24,8 @@ #include #include "local.h" +#define _DEFAULT_ASPRINTF_BUFSIZE 64 + /* * Allocate a file buffer, or switch to unbuffered I/O. * Per the ANSI C standard, ALL tty devices default to line buffered. @@ -53,7 +55,11 @@ _DEFUN(__smakebuf, (fp), #endif { couldbetty = 0; - size = BUFSIZ; + /* Check if we are be called by asprintf family for initial buffer. */ + if (fp->_flags & __SMBF) + size = _DEFAULT_ASPRINTF_BUFSIZE; + else + size = BUFSIZ; /* do not try to optimise fseek() */ fp->_flags |= __SNPT; } -- cgit v1.2.3