summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark-Jason Dominus <mjd@plover.com>2002-03-01 13:35:35 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2002-03-02 02:24:25 +0000
commitd19c0e07ebd08db71e942d0ac908b6a0cb59810f (patch)
tree77bb9a90ac7782e15ac603fc6b4fc021adef490b
parent62658f4d9934aba5f8b23afcc078dc12b3a40223 (diff)
downloadperl-d19c0e07ebd08db71e942d0ac908b6a0cb59810f.tar.gz
PATCH (bleadperl): Quieter handling of tied arrays
Message-ID: <20020301233535.15969.qmail@plover.com> p4raw-id: //depot/perl@14938
-rw-r--r--av.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/av.c b/av.c
index d0428925a7..95ec169f02 100644
--- a/av.c
+++ b/av.c
@@ -514,8 +514,8 @@ Perl_av_pop(pTHX_ register AV *av)
SV *retval;
MAGIC* mg;
- if (!av || AvFILL(av) < 0)
- return &PL_sv_undef;
+ if (!av)
+ return &PL_sv_undef;
if (SvREADONLY(av))
Perl_croak(aTHX_ PL_no_modify);
if ((mg = SvTIED_mg((SV*)av, PERL_MAGIC_tied))) {
@@ -534,6 +534,8 @@ Perl_av_pop(pTHX_ register AV *av)
POPSTACK;
return retval;
}
+ if (AvFILL(av) < 0)
+ return &PL_sv_undef;
retval = AvARRAY(av)[AvFILLp(av)];
AvARRAY(av)[AvFILLp(av)--] = &PL_sv_undef;
if (SvSMAGICAL(av))
@@ -559,7 +561,7 @@ Perl_av_unshift(pTHX_ register AV *av, register I32 num)
MAGIC* mg;
I32 slide;
- if (!av || num <= 0)
+ if (!av)
return;
if (SvREADONLY(av))
Perl_croak(aTHX_ PL_no_modify);
@@ -581,6 +583,8 @@ Perl_av_unshift(pTHX_ register AV *av, register I32 num)
return;
}
+ if (num <= 0)
+ return;
if (!AvREAL(av) && AvREIFY(av))
av_reify(av);
i = AvARRAY(av) - AvALLOC(av);
@@ -626,7 +630,7 @@ Perl_av_shift(pTHX_ register AV *av)
SV *retval;
MAGIC* mg;
- if (!av || AvFILL(av) < 0)
+ if (!av)
return &PL_sv_undef;
if (SvREADONLY(av))
Perl_croak(aTHX_ PL_no_modify);
@@ -646,6 +650,8 @@ Perl_av_shift(pTHX_ register AV *av)
POPSTACK;
return retval;
}
+ if (AvFILL(av) < 0)
+ return &PL_sv_undef;
retval = *AvARRAY(av);
if (AvREAL(av))
*AvARRAY(av) = &PL_sv_undef;