diff options
author | Ulrich Drepper <drepper@redhat.com> | 2009-04-10 03:56:06 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2009-04-10 03:56:06 +0000 |
commit | 1d498daa95384e5c9ad5bcb35e7a996e5869ac39 (patch) | |
tree | 3c1a82ce8376cb1f8a9769d31772d3620cb348fd /stdio-common | |
parent | e9b4d069c1897d1480655dc6f25e905b1ce749a6 (diff) | |
download | glibc-1d498daa95384e5c9ad5bcb35e7a996e5869ac39.zip glibc-1d498daa95384e5c9ad5bcb35e7a996e5869ac39.tar.gz glibc-1d498daa95384e5c9ad5bcb35e7a996e5869ac39.tar.bz2 |
Simplified code and possible copy problem fixed.
Diffstat (limited to 'stdio-common')
-rw-r--r-- | stdio-common/vfprintf.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index 819865f..5a24e72 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -1662,24 +1662,10 @@ do_positional: { /* Extend the array of format specifiers. */ 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. */ - memcpy (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; - } + /* Copy the old array's elements to the new space. */ + memmove (specs, old, nspecs * sizeof (struct printf_spec)); } /* Parse the format specifier. */ |