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/libc/stdio/makebuf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'newlib/libc/stdio/makebuf.c') 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