/* av.c
*
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- * 2000, 2001, 2002, 2003, by Larry Wall and others
+ * 2000, 2001, 2002, 2003, 2004, 2005 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.
return 0;
if (SvRMAGICAL(av)) {
- MAGIC *tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
+ const MAGIC * const tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
if (tied_magic || mg_find((SV*)av, PERL_MAGIC_regdata)) {
U32 adjust_index = 1;
val = &PL_sv_undef;
if (SvRMAGICAL(av)) {
- MAGIC *tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
+ const MAGIC * const tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
if (tied_magic) {
/* Handle negative array indices 20020222 MJD */
if (key < 0) {
Perl_av_make(pTHX_ register I32 size, register SV **strp)
{
register AV *av;
- register I32 i;
- register SV** ary;
av = (AV*)NEWSV(8,0);
sv_upgrade((SV *) av,SVt_PVAV);
AvFLAGS(av) = AVf_REAL;
if (size) { /* `defined' was returning undef for size==0 anyway. */
+ register SV** ary;
+ register I32 i;
New(4,ary,size,SV*);
AvALLOC(av) = ary;
SvPVX(av) = (char*)ary;
Perl_av_clear(pTHX_ register AV *av)
{
register I32 key;
- SV** ary;
#ifdef DEBUGGING
if (SvREFCNT(av) == 0 && ckWARN_d(WARN_DEBUGGING)) {
return;
if (AvREAL(av)) {
- ary = AvARRAY(av);
+ SV** ary = AvARRAY(av);
key = AvFILLp(av) + 1;
while (key) {
SV * sv = ary[--key];
*/
I32
-Perl_av_len(pTHX_ register AV *av)
+Perl_av_len(pTHX_ const register AV *av)
{
return AvFILL(av);
}
Perl_croak(aTHX_ PL_no_modify);
if (SvRMAGICAL(av)) {
- MAGIC *tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
- SV **svp;
+ const MAGIC * const tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
if ((tied_magic || mg_find((SV*)av, PERL_MAGIC_regdata))) {
/* Handle negative array indices 20020222 MJD */
+ SV **svp;
if (key < 0) {
unsigned adjust_index = 1;
if (tied_magic) {
SvREFCNT_dec(sv);
sv = Nullsv;
}
- else
+ else if (AvREAL(av))
sv = sv_2mortal(sv);
return sv;
}
if (SvRMAGICAL(av)) {
- MAGIC *tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
+ const MAGIC * const tied_magic = mg_find((SV*)av, PERL_MAGIC_tied);
if (tied_magic || mg_find((SV*)av, PERL_MAGIC_regdata)) {
SV *sv = sv_newmortal();
MAGIC *mg;