summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorVincent Pit <perl@profvince.com>2012-06-22 15:55:55 +0200
committerVincent Pit <perl@profvince.com>2012-06-22 15:56:29 +0200
commit83f29afad70b612d23a170f28fca57f0c8ca24af (patch)
tree9f78339bae9fdd7957da5b2283e39cce20274318 /mg.c
parent7762c3748b5616504fc9a8c5dd0c0e078d85eec5 (diff)
downloadperl-83f29afad70b612d23a170f28fca57f0c8ca24af.tar.gz
Reset the iterator when an array is cleared
This fixes RT #75596.
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/mg.c b/mg.c
index 4424bfebc3..4d6df84d4f 100644
--- a/mg.c
+++ b/mg.c
@@ -2043,6 +2043,21 @@ Perl_magic_setarylen(pTHX_ SV *sv, MAGIC *mg)
}
int
+Perl_magic_cleararylen_p(pTHX_ SV *sv, MAGIC *mg)
+{
+ dVAR;
+
+ PERL_ARGS_ASSERT_MAGIC_CLEARARYLEN_P;
+ PERL_UNUSED_ARG(sv);
+
+ /* Reset the iterator when the array is cleared */
+ if (mg->mg_ptr)
+ *((IV *) mg->mg_ptr) = 0;
+
+ return 0;
+}
+
+int
Perl_magic_freearylen_p(pTHX_ SV *sv, MAGIC *mg)
{
dVAR;