summaryrefslogtreecommitdiff
path: root/av.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-10-25 06:33:43 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-10-25 06:33:43 +0000
commit33c2748902d07b7ec367f87ad66e61e89f2aa994 (patch)
treefde7996e8953d60e19976c0365224c3ba03cf565 /av.c
parent2e7e7c6ca2ccdf33926d1330538338beae355adb (diff)
downloadperl-33c2748902d07b7ec367f87ad66e61e89f2aa994.tar.gz
integrate changes#1982,2014,2021 (from maint-5.005)
p4raw-link: @2021 on //depot/maint-5.005/perl: ece095e7b265a16d4ec3543b1418100f9c635a87 p4raw-link: @2014 on //depot/maint-5.005/perl: cca0b9804acab4b7678c0f185888d57497a5c2a9 p4raw-link: @1982 on //depot/maint-5.005/perl: fe676099d996f70caaedeb6ae85adc3ee59d2240 p4raw-id: //depot/perl@2059
Diffstat (limited to 'av.c')
-rw-r--r--av.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/av.c b/av.c
index 5242ffc887..f3c69e76ce 100644
--- a/av.c
+++ b/av.c
@@ -24,7 +24,7 @@ av_reify(AV *av)
if (AvREAL(av))
return;
#ifdef DEBUGGING
- if (SvRMAGICAL(av) && mg_find((SV*)av,'P'))
+ if (SvTIED_mg((SV*)av, 'P'))
warn("av_reify called on tied array");
#endif
key = AvMAX(av) + 1;
@@ -50,14 +50,14 @@ av_extend(AV *av, I32 key)
{
dTHR; /* only necessary if we have to extend stack */
MAGIC *mg;
- if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
+ if (mg = SvTIED_mg((SV*)av, 'P')) {
dSP;
ENTER;
SAVETMPS;
PUSHSTACKi(PERLSI_MAGIC);
PUSHMARK(SP);
EXTEND(SP,2);
- PUSHs(mg->mg_obj);
+ PUSHs(SvTIED_obj((SV*)av, mg));
PUSHs(sv_2mortal(newSViv(key+1)));
PUTBACK;
perl_call_method("EXTEND", G_SCALAR|G_DISCARD);
@@ -371,7 +371,7 @@ av_undef(register AV *av)
/*SUPPRESS 560*/
/* Give any tie a chance to cleanup first */
- if (SvRMAGICAL(av) && mg_find((SV*)av,'P'))
+ if (SvTIED_mg((SV*)av, 'P'))
av_fill(av, -1); /* mg_clear() ? */
if (AvREAL(av)) {
@@ -398,12 +398,12 @@ av_push(register AV *av, SV *val)
if (SvREADONLY(av))
croak(no_modify);
- if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
+ if (mg = SvTIED_mg((SV*)av, 'P')) {
dSP;
PUSHSTACKi(PERLSI_MAGIC);
PUSHMARK(SP);
EXTEND(SP,2);
- PUSHs(mg->mg_obj);
+ PUSHs(SvTIED_obj((SV*)av, mg));
PUSHs(val);
PUTBACK;
ENTER;
@@ -425,11 +425,11 @@ av_pop(register AV *av)
return &PL_sv_undef;
if (SvREADONLY(av))
croak(no_modify);
- if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
+ if (mg = SvTIED_mg((SV*)av, 'P')) {
dSP;
PUSHSTACKi(PERLSI_MAGIC);
PUSHMARK(SP);
- XPUSHs(mg->mg_obj);
+ XPUSHs(SvTIED_obj((SV*)av, mg));
PUTBACK;
ENTER;
if (perl_call_method("POP", G_SCALAR)) {
@@ -460,12 +460,12 @@ av_unshift(register AV *av, register I32 num)
if (SvREADONLY(av))
croak(no_modify);
- if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
+ if (mg = SvTIED_mg((SV*)av, 'P')) {
dSP;
PUSHSTACKi(PERLSI_MAGIC);
PUSHMARK(SP);
EXTEND(SP,1+num);
- PUSHs(mg->mg_obj);
+ PUSHs(SvTIED_obj((SV*)av, mg));
while (num-- > 0) {
PUSHs(&PL_sv_undef);
}
@@ -511,11 +511,11 @@ av_shift(register AV *av)
return &PL_sv_undef;
if (SvREADONLY(av))
croak(no_modify);
- if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
+ if (mg = SvTIED_mg((SV*)av, 'P')) {
dSP;
PUSHSTACKi(PERLSI_MAGIC);
PUSHMARK(SP);
- XPUSHs(mg->mg_obj);
+ XPUSHs(SvTIED_obj((SV*)av, mg));
PUTBACK;
ENTER;
if (perl_call_method("SHIFT", G_SCALAR)) {
@@ -552,14 +552,14 @@ av_fill(register AV *av, I32 fill)
croak("panic: null array");
if (fill < 0)
fill = -1;
- if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
+ if (mg = SvTIED_mg((SV*)av, 'P')) {
dSP;
ENTER;
SAVETMPS;
PUSHSTACKi(PERLSI_MAGIC);
PUSHMARK(SP);
EXTEND(SP,2);
- PUSHs(mg->mg_obj);
+ PUSHs(SvTIED_obj((SV*)av, mg));
PUSHs(sv_2mortal(newSViv(fill+1)));
PUTBACK;
perl_call_method("STORESIZE", G_SCALAR|G_DISCARD);