summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-02-10 09:57:23 +0000
committerNicholas Clark <nick@ccl4.org>2010-05-24 15:50:57 +0100
commitd5b1589c09b534ccfeb2eae26b3de9339c1bf22b (patch)
tree64fa4c03090b557d0687e9e3e845a62d74dc01fd /pad.c
parente42956688f2e0df936f1a42811962946e4e185bf (diff)
downloadperl-d5b1589c09b534ccfeb2eae26b3de9339c1bf22b.tar.gz
Convert PAD_DUP to a function Perl_padlist_dup().
assert() that pads are never AvREAL().
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/pad.c b/pad.c
index f941252692..99b25c8e59 100644
--- a/pad.c
+++ b/pad.c
@@ -1752,6 +1752,31 @@ Perl_pad_compname_type(pTHX_ const PADOFFSET po)
return NULL;
}
+#if defined(USE_ITHREADS)
+
+# define av_dup_inc(s,t) MUTABLE_AV(sv_dup_inc((const SV *)s,t))
+
+AV *
+Perl_padlist_dup(pTHX_ AV *const srcpad, CLONE_PARAMS *const param)
+{
+ AV *dstpad;
+ PERL_ARGS_ASSERT_PADLIST_DUP;
+
+ if (!srcpad)
+ return NULL;
+
+ assert(!AvREAL(srcpad));
+ /* XXX padlists are real, but pretend to be not */
+ AvREAL_on(srcpad);
+ dstpad = av_dup_inc(srcpad, param);
+ AvREAL_off(srcpad);
+ AvREAL_off(dstpad);
+
+ return dstpad;
+}
+
+#endif
+
/*
* Local variables:
* c-indentation-style: bsd