/* av.c
*
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- * 2000, 2001, 2002, 2003, 2004, 2005, 2006, by Larry Wall and others
+ * 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
}
/*
-=for apidoc newAV
-
-Creates a new AV. The reference count is set to 1.
-
-=cut
-*/
-
-AV *
-Perl_newAV(pTHX)
-{
- register AV * const av = (AV*)newSV_type(SVt_PVAV);
- /* sv_upgrade does AvREAL_only() */
- AvALLOC(av) = 0;
- AvARRAY(av) = NULL;
- AvMAX(av) = AvFILLp(av) = -1;
- return av;
-}
-
-/*
=for apidoc av_make
Creates a new AV and populates it with a list of SVs. The SVs are copied
return FALSE;
}
-SV **
-Perl_av_arylen_p(pTHX_ AV *av) {
+MAGIC *
+S_get_aux_mg(pTHX_ AV *av) {
dVAR;
MAGIC *mg;
/* sv_magicext won't set this for us because we pass in a NULL obj */
mg->mg_flags |= MGf_REFCOUNTED;
}
+ return mg;
+}
+
+SV **
+Perl_av_arylen_p(pTHX_ AV *av) {
+ MAGIC *const mg = get_aux_mg(av);
return &(mg->mg_obj);
}
+/* This will change to returning IV ** at some point soon */
+I32 *
+Perl_av_iter_p(pTHX_ AV *av) {
+ MAGIC *const mg = get_aux_mg(av);
+ return &(mg->mg_len);
+}
+
/*
* Local variables:
* c-indentation-style: bsd