summaryrefslogtreecommitdiff
path: root/universal.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-08-04 11:22:03 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-08-04 11:22:03 -0700
commit38be3d0038ef87b22af88f80db1fbeb0292ce53b (patch)
treeec90a2d8674378fb4a23f38d89acb799c3881bc3 /universal.c
parentc56ed9f6dbe3d89129c7f5a37b28d4fc398561e4 (diff)
downloadperl-38be3d0038ef87b22af88f80db1fbeb0292ce53b.tar.gz
Don’t let list const modification affect future retvals
In commit f99a5f08f203, I inadvertently made modifications to val- ues return by list ‘constants’ affect what values are returned sub- sequently. It’s for this type of situation that PADTMP exists (values are never referenced, but copied). So use it. This is similar to 5608dcc62, which fixed #3105.
Diffstat (limited to 'universal.c')
-rw-r--r--universal.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/universal.c b/universal.c
index a57572bdfb..46511d30c9 100644
--- a/universal.c
+++ b/universal.c
@@ -921,6 +921,15 @@ XS(XS_Internals_SvREADONLY) /* This is dangerous stuff. */
if (SvTRUE(ST(1))) {
if (SvIsCOW(sv)) sv_force_normal(sv);
SvREADONLY_on(sv);
+ if (SvTYPE(sv) == SVt_PVAV && AvFILLp(sv) != -1) {
+ /* for constant.pm; nobody else should be calling this
+ on arrays anyway. */
+ SV **svp;
+ for (svp = AvARRAY(sv) + AvFILLp(sv)
+ ; svp >= AvARRAY(sv)
+ ; --svp)
+ if (*svp) SvPADTMP_on(*svp);
+ }
XSRETURN_YES;
}
else {