diff options
author | Andreas Jaeger <aj@suse.de> | 2001-03-05 19:14:54 +0000 |
---|---|---|
committer | Andreas Jaeger <aj@suse.de> | 2001-03-05 19:14:54 +0000 |
commit | 587bf4adcd189f758557e6b7083dfa35364f8cdb (patch) | |
tree | ff03feef62bce109abf3c7d95a2e77115eed3924 /stdlib/msort.c | |
parent | f4fe532057acb17a53442f0b5ae8860eaefeb5ce (diff) | |
download | glibc-587bf4adcd189f758557e6b7083dfa35364f8cdb.tar.gz glibc-587bf4adcd189f758557e6b7083dfa35364f8cdb.tar.xz glibc-587bf4adcd189f758557e6b7083dfa35364f8cdb.zip |
(qsort): Don't use alloca in a function call.
Diffstat (limited to 'stdlib/msort.c')
-rw-r--r-- | stdlib/msort.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/stdlib/msort.c b/stdlib/msort.c index d174edd3b7..7d5409b30f 100644 --- a/stdlib/msort.c +++ b/stdlib/msort.c @@ -1,6 +1,6 @@ /* An alternative to qsort, with an identical interface. This file is part of the GNU C Library. - Copyright (C) 1992, 1995-1997, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1992, 1995-1997, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Mike Haertel, September 1988. The GNU C Library is free software; you can redistribute it and/or @@ -91,8 +91,12 @@ qsort (void *b, size_t n, size_t s, __compar_fn_t cmp) const size_t size = n * s; if (size < 1024) - /* The temporary array is small, so put it on the stack. */ - msort_with_tmp (b, n, s, cmp, __alloca (size)); + { + void *buf = __alloca (size); + + /* The temporary array is small, so put it on the stack. */ + msort_with_tmp (b, n, s, cmp, buf); + } else { /* We should avoid allocating too much memory since this might |