summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-09-06 00:51:16 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-09-06 06:18:08 -0700
commit199f858d54d30a550be7320e065420353bca5318 (patch)
treed59886518fdbd5c6bb873ebe8e54526cb45f521f /sv.c
parentdd2a7f9048da2c440a4dfed5122c0bfd98f079d3 (diff)
downloadperl-199f858d54d30a550be7320e065420353bca5318.tar.gz
Put AV defelem creation code in one place
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index f53ffdde2a..d6f3338b08 100644
--- a/sv.c
+++ b/sv.c
@@ -9661,6 +9661,19 @@ Perl_newSVrv(pTHX_ SV *const rv, const char *const classname)
return sv;
}
+SV *
+Perl_newSVavdefelem(pTHX_ AV *av, SSize_t ix, bool extendible)
+{
+ SV * const lv = newSV_type(SVt_PVLV);
+ PERL_ARGS_ASSERT_NEWSVAVDEFELEM;
+ LvTYPE(lv) = 'y';
+ sv_magic(lv, NULL, PERL_MAGIC_defelem, NULL, 0);
+ LvTARG(lv) = SvREFCNT_inc_simple_NN(av);
+ LvSTARGOFF(lv) = ix;
+ LvTARGLEN(lv) = extendible ? 1 : (STRLEN)UV_MAX;
+ return lv;
+}
+
/*
=for apidoc sv_setref_pv