mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
Simplified code and possible copy problem fixed.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
2009-04-09 Ulrich Drepper <drepper@redhat.com>
|
2009-04-09 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* stdio-common/vfprintf.c (vfprintf): Slightly more compact code.
|
* stdio-common/vfprintf.c (vfprintf): Slightly more compact code.
|
||||||
|
Simplified code and possible copy problem fixed.
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/preadv.c: Avoid prototype for static
|
* sysdeps/unix/sysv/linux/preadv.c: Avoid prototype for static
|
||||||
function if it is not defined. Add some necessary casts.
|
function if it is not defined. Add some necessary casts.
|
||||||
|
@@ -1662,24 +1662,10 @@ do_positional:
|
|||||||
{
|
{
|
||||||
/* Extend the array of format specifiers. */
|
/* Extend the array of format specifiers. */
|
||||||
struct printf_spec *old = specs;
|
struct printf_spec *old = specs;
|
||||||
|
specs = extend_alloca (specs, nspecs_max, 2 * nspecs_max);
|
||||||
|
|
||||||
nspecs_max *= 2;
|
|
||||||
specs = alloca (nspecs_max * sizeof (struct printf_spec));
|
|
||||||
|
|
||||||
if (specs == &old[nspecs])
|
|
||||||
/* Stack grows up, OLD was the last thing allocated;
|
|
||||||
extend it. */
|
|
||||||
nspecs_max += nspecs_max / 2;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Copy the old array's elements to the new space. */
|
/* Copy the old array's elements to the new space. */
|
||||||
memcpy (specs, old, nspecs * sizeof (struct printf_spec));
|
memmove (specs, old, nspecs * sizeof (struct printf_spec));
|
||||||
if (old == &specs[nspecs])
|
|
||||||
/* Stack grows down, OLD was just below the new
|
|
||||||
SPECS. We can use that space when the new space
|
|
||||||
runs out. */
|
|
||||||
nspecs_max += nspecs_max / 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse the format specifier. */
|
/* Parse the format specifier. */
|
||||||
|
Reference in New Issue
Block a user