This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Goodbye xav_arylen. You won't be missed that much.
[perl5.git] / av.c
diff --git a/av.c b/av.c
index 12b2ee3..7201893 100644 (file)
--- a/av.c
+++ b/av.c
@@ -936,6 +936,23 @@ Perl_av_exists(pTHX_ AV *av, I32 key)
        return FALSE;
 }
 
+SV **
+Perl_av_arylen_p(pTHX_ AV *av) {
+    dVAR;
+    MAGIC *mg = mg_find((SV*)av, PERL_MAGIC_arylen_p);
+
+    if (!mg) {
+       mg = sv_magicext((SV*)av, 0, PERL_MAGIC_arylen_p, 0, 0, 0);
+
+       if (!mg) {
+           Perl_die(aTHX_ "panic: av_arylen_p");
+       }
+       /* sv_magicext won't set this for us because we pass in a NULL obj  */
+       mg->mg_flags |= MGf_REFCOUNTED;
+    }
+    return &(mg->mg_obj);
+}
+
 /*
  * Local variables:
  * c-indentation-style: bsd