aboutsummaryrefslogtreecommitdiff
path: root/stdio-common/vfprintf.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-10-09 09:42:48 +0000
committerUlrich Drepper <drepper@redhat.com>2002-10-09 09:42:48 +0000
commit6166815d696407069c33c1f0cad76fb1847e4bc7 (patch)
treed7aaf5fd8551eb6d69fb80863a4a415cfaa9c01a /stdio-common/vfprintf.c
parent4c2821faea94c4300fe283f13e4a667f1f73b90b (diff)
downloadglibc-6166815d696407069c33c1f0cad76fb1847e4bc7.tar
glibc-6166815d696407069c33c1f0cad76fb1847e4bc7.tar.gz
glibc-6166815d696407069c33c1f0cad76fb1847e4bc7.tar.bz2
glibc-6166815d696407069c33c1f0cad76fb1847e4bc7.zip
Update.
2002-10-09 Ulrich Drepper <drepper@redhat.com> * Versions.def (libc): Add GLIBC_2.3.1. (libpthread): Add GLIBC_2.3.1. * include/signal.h: Add libc_hidden_proto for __sigwait, __sigwaitinfo, and __sigtimedwait. * signal/Versions: Add __sigtimedwait, __sigwait, and __sigwaitinfo. * sysdeps/unix/sysv/linux/sigtimedwait.c (__sigtimedwait): Add libc_hidden_def. * sysdeps/unix/sysv/linux/sigwait.c (__sigwait): Likewise. * sysdeps/unix/sysv/linux/sigwaitinfo.c (__sigwaitinfo): Likewise. * include/sys/msg.h: Declare __libc_msgrcv and __libc_msgsnd. * sysdeps/unix/sysv/linux/msgrcv.c (__msgrcv): Rename to __libc_msgrcv and make old name an alias. * sysdeps/unix/sysv/linux/msgsnd.c (__msgsnd): Rename to __libc_msgsnd and make old name an alias. * sysvipc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_msgrcv and __libc_msgsnd. * include/sys/uio.h: Declare __libc_readv and __libc_writev. * misc/Versions (libc) [GLIBC_PRIVATE]: Add __libc_readv and __libc_writev. * sysdeps/generic/readv.c (__readv): Rename to __libc_readv and make old name an alias. * sysdeps/posix/readv.c: Likewise * sysdeps/unix/sysv/aix/readv.c: Likewise. * sysdeps/unix/sysv/linux/readv.c: Likewise. * sysdeps/generic/writev.c (__writev): Rename to __libc_writev and make old name an alias. * sysdeps/posix/writev.c: Likewise * sysdeps/unix/sysv/aix/writev.c: Likewise. * sysdeps/unix/sysv/linux/writev.c: Likewise. * include/sys/wait.h: Declare __waitid. * posix/Versions (libc) [GLIBC_PRIVATE]: Add __waitid. * sysdeps/generic/waitid.c (waitid): Rename to __waitid and make old name an alias. * sysdeps/posix/waitid.c: Likewise. * sysdeps/unix/sysv/aix/waitid.c: Likewise. * sysdeps/unix/sysv/linux/syscalls.list: Add creat syscall. 2002-10-07 Jakub Jelinek <jakub@redhat.com> * include/alloca.h (__libc_use_alloca, __libc_alloca_cutoff): New prototypes. (__MAX_ALLOCA_CUTOFF): Define. Include allocalim.h. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r, _nss_dns_gethostbyaddr_r): Use alloca or malloc to allocate host_buffer depending on __libc_use_alloca. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r, _nss_dns_getnetbyaddr_r): Use alloca or malloc to allocate net_buffer depending on __libc_use_alloca. * resolv/res_query.c (res_nquery): Use alloca or malloc to allocate buf depending on __libc_use_alloca. * resolv/gethnamaddr.c (gethostbyname2, gethostbyaddr): Likewise. * stdio-common/vfprintf.c (vfprintf): Use __libc_use_alloca instead of hardcoded constants. Pass proper size argument to alloca and compute end for wide char version. * stdio-common/printf_fp.c (__printf_fp): Use __libc_use_alloca instead of hardcoded constants. * string/strcoll.c (strcoll): Likewise. * string/strxfrm.c (strxfrm): Likewise. * sysdeps/posix/readv.c (__readv): Likewise. * sysdeps/posix/writev.c (__writev): Likewise. * sysdeps/generic/allocalim.h: New file.
Diffstat (limited to 'stdio-common/vfprintf.c')
-rw-r--r--stdio-common/vfprintf.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index 788290b803..4f9cd9b424 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -1039,7 +1039,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
\
/* Allocate dynamically an array which definitely is long \
enough for the wide character version. */ \
- if (len < 8192) \
+ if (__libc_use_alloca (len * sizeof (wchar_t))) \
string = (CHAR_T *) alloca (len * sizeof (wchar_t)); \
else if ((string = (CHAR_T *) malloc (len * sizeof (wchar_t))) \
== NULL) \
@@ -1201,7 +1201,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
if (prec >= 0) \
{ \
/* The string `s2' might not be NUL terminated. */ \
- if (prec < 32768) \
+ if (__libc_use_alloca (prec)) \
string = (char *) alloca (prec); \
else if ((string = (char *) malloc (prec)) == NULL) \
{ \
@@ -1219,7 +1219,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
{ \
assert (__mbsinit (&mbstate)); \
s2 = (const wchar_t *) string; \
- if (len + 1 < 32768) \
+ if (__libc_use_alloca (len + 1)) \
string = (char *) alloca (len + 1); \
else if ((string = (char *) malloc (len + 1)) == NULL) \
{ \
@@ -1448,7 +1448,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
{
/* We have to use a special buffer. The "32" is just a safe
bet for all the output which is not counted in the width. */
- if (width < (int) (32768 / sizeof (CHAR_T)))
+ if (__libc_use_alloca ((width + 32) * sizeof (CHAR_T)))
workend = ((CHAR_T *) alloca ((width + 32) * sizeof (CHAR_T))
+ (width + 32));
else
@@ -1473,7 +1473,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
{
/* We have to use a special buffer. The "32" is just a safe
bet for all the output which is not counted in the width. */
- if (width < (int) (32768 / sizeof (CHAR_T)))
+ if (__libc_use_alloca ((width + 32) * sizeof (CHAR_T)))
workend = ((CHAR_T *) alloca ((width + 32) * sizeof (CHAR_T))
+ (width + 32));
else
@@ -1516,8 +1516,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
if (prec > width
&& prec + 32 > (int)(sizeof (work_buffer) / sizeof (work_buffer[0])))
{
- if (prec < (int) (32768 / sizeof (CHAR_T)))
- workend = alloca (prec + 32) + (prec + 32);
+ if (__libc_use_alloca ((prec + 32) * sizeof (CHAR_T)))
+ workend = ((CHAR_T *) alloca ((prec + 32) * sizeof (CHAR_T)))
+ + (prec + 32);
else
{
workstart = (CHAR_T *) malloc ((prec + 32) * sizeof (CHAR_T));
@@ -1832,7 +1833,8 @@ do_positional:
if (MAX (prec, width) + 32 > (int) (sizeof (work_buffer)
/ sizeof (CHAR_T)))
{
- if (MAX (prec, width) < (int) (32768 / sizeof (CHAR_T)))
+ if (__libc_use_alloca ((MAX (prec, width) + 32)
+ * sizeof (CHAR_T)))
workend = ((CHAR_T *) alloca ((MAX (prec, width) + 32)
* sizeof (CHAR_T))
+ (MAX (prec, width) + 32));