aboutsummaryrefslogtreecommitdiff
path: root/libio
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-26 05:11:53 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-26 05:11:53 +0000
commit5cec9552a6ea2a7bc1d4d6a6a5ed48c71f0ca962 (patch)
tree3dd2973f4171d1d6aa18f914a798a95323a83ca6 /libio
parentac5e137cd9154594cc46f5925276e4fa2f596fa0 (diff)
downloadglibc-5cec9552a6ea2a7bc1d4d6a6a5ed48c71f0ca962.zip
glibc-5cec9552a6ea2a7bc1d4d6a6a5ed48c71f0ca962.tar.gz
glibc-5cec9552a6ea2a7bc1d4d6a6a5ed48c71f0ca962.tar.bz2
[BZ #346]
Update. * libio/vasprintf.c (_IO_vasprintf): Fix condition to decide whether to realloc or not. Reported by Pavel Kankovsky <peak@argo.troja.mff.cuni.cz> [BZ #346].
Diffstat (limited to 'libio')
-rw-r--r--libio/vasprintf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libio/vasprintf.c b/libio/vasprintf.c
index 4e5b7f4..e32a488 100644
--- a/libio/vasprintf.c
+++ b/libio/vasprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1997,1999,2000,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1999-2002,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -64,11 +64,11 @@ _IO_vasprintf (result_ptr, format, args)
free (sf._sbf._f._IO_buf_base);
return ret;
}
- /* Only use realloc if the size we need is of the same order of
- magnitude then the memory we allocated. */
+ /* Only use realloc if the size we need is of the same (binary)
+ order of magnitude then the memory we allocated. */
needed = sf._sbf._f._IO_write_ptr - sf._sbf._f._IO_write_base + 1;
allocated = sf._sbf._f._IO_write_end - sf._sbf._f._IO_write_base;
- if ((allocated << 1) <= needed)
+ if ((allocated >> 1) <= needed)
*result_ptr = (char *) realloc (sf._sbf._f._IO_buf_base, needed);
else
{