summaryrefslogtreecommitdiff
path: root/pp_sort.c
diff options
context:
space:
mode:
authorGerard Goossen <gerard@ggoossen.net>2010-06-23 16:26:58 +0100
committerNicholas Clark <nick@ccl4.org>2010-06-23 16:36:33 +0100
commit8f443ca6a3a77930ce80210fd1c0e9ee627daa9e (patch)
tree4713608f8c457f2676ce99c22f137ff56c961c0f /pp_sort.c
parentf1c7503b9028d20741c9a01345ba8704998ea381 (diff)
downloadperl-8f443ca6a3a77930ce80210fd1c0e9ee627daa9e.tar.gz
In S_sortcv_stacked(), handle @_ correctly. Fix for #72334.
Remove AvREAL from @_, and set AvALLOC when reallocating @_.
Diffstat (limited to 'pp_sort.c')
-rw-r--r--pp_sort.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/pp_sort.c b/pp_sort.c
index b0f2be1e83..51cf216a62 100644
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1771,8 +1771,13 @@ S_sortcv_stacked(pTHX_ SV *const a, SV *const b)
PERL_ARGS_ASSERT_SORTCV_STACKED;
+ if (AvREAL(av)) {
+ av_clear(av);
+ AvREAL_off(av);
+ AvREIFY_on(av);
+ }
if (AvMAX(av) < 1) {
- SV** ary = AvALLOC(av);
+ SV **ary = AvALLOC(av);
if (AvARRAY(av) != ary) {
AvMAX(av) += AvARRAY(av) - AvALLOC(av);
AvARRAY(av) = ary;
@@ -1781,6 +1786,7 @@ S_sortcv_stacked(pTHX_ SV *const a, SV *const b)
AvMAX(av) = 1;
Renew(ary,2,SV*);
AvARRAY(av) = ary;
+ AvALLOC(av) = ary;
}
}
AvFILLp(av) = 1;