diff options
author | Rick Delaney <rick@consumercontact.com> | 2005-08-22 09:00:33 -0400 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-08-23 13:25:15 +0000 |
commit | 5b295bef27e91243a93cdb460dcf005e5bf35426 (patch) | |
tree | bcca3ea1266736c0c5f577d2acecb84aaf39b68a | |
parent | b76aa5af2840585626e18c84f60feb97c68abd14 (diff) | |
download | perl-5b295bef27e91243a93cdb460dcf005e5bf35426.tar.gz |
Use SvGETMAGIC more often
Message-ID: <20050822170033.GH7674@localhost.localdomain>
p4raw-id: //depot/perl@25322
-rw-r--r-- | doio.c | 3 | ||||
-rw-r--r-- | pp.c | 28 | ||||
-rw-r--r-- | pp_ctl.c | 9 | ||||
-rw-r--r-- | pp_hot.c | 12 | ||||
-rw-r--r-- | sv.c | 18 | ||||
-rw-r--r-- | universal.c | 9 | ||||
-rw-r--r-- | xsutils.c | 3 |
7 files changed, 30 insertions, 52 deletions
@@ -1308,8 +1308,7 @@ Perl_do_print(pTHX_ register SV *sv, PerlIO *fp) return TRUE; case SVt_IV: if (SvIOK(sv)) { - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (SvIsUV(sv)) PerlIO_printf(fp, "%"UVuf, (UV)SvUVX(sv)); else @@ -505,8 +505,8 @@ PP(pp_ref) const char *pv; SV * const sv = POPs; - if (sv && SvGMAGICAL(sv)) - mg_get(sv); + if (sv) + SvGETMAGIC(sv); if (!sv || !SvROK(sv)) RETPUSHNO; @@ -755,8 +755,7 @@ PP(pp_defined) RETPUSHYES; break; default: - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (SvOK(sv)) RETPUSHYES; } @@ -1384,8 +1383,7 @@ PP(pp_repeat) { register IV count; dPOPss; - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (SvIOKp(sv)) { if (SvUOK(sv)) { const UV uv = SvUV(sv); @@ -2223,8 +2221,8 @@ PP(pp_bit_and) dSP; dATARGET; tryAMAGICbin(band,opASSIGN); { dPOPTOPssrl; - if (SvGMAGICAL(left)) mg_get(left); - if (SvGMAGICAL(right)) mg_get(right); + SvGETMAGIC(left); + SvGETMAGIC(right); if (SvNIOKp(left) || SvNIOKp(right)) { if (PL_op->op_private & HINT_INTEGER) { const IV i = SvIV_nomg(left) & SvIV_nomg(right); @@ -2248,8 +2246,8 @@ PP(pp_bit_xor) dSP; dATARGET; tryAMAGICbin(bxor,opASSIGN); { dPOPTOPssrl; - if (SvGMAGICAL(left)) mg_get(left); - if (SvGMAGICAL(right)) mg_get(right); + SvGETMAGIC(left); + SvGETMAGIC(right); if (SvNIOKp(left) || SvNIOKp(right)) { if (PL_op->op_private & HINT_INTEGER) { const IV i = (USE_LEFT(left) ? SvIV_nomg(left) : 0) ^ SvIV_nomg(right); @@ -2273,8 +2271,8 @@ PP(pp_bit_or) dSP; dATARGET; tryAMAGICbin(bor,opASSIGN); { dPOPTOPssrl; - if (SvGMAGICAL(left)) mg_get(left); - if (SvGMAGICAL(right)) mg_get(right); + SvGETMAGIC(left); + SvGETMAGIC(right); if (SvNIOKp(left) || SvNIOKp(right)) { if (PL_op->op_private & HINT_INTEGER) { const IV i = (USE_LEFT(left) ? SvIV_nomg(left) : 0) | SvIV_nomg(right); @@ -2299,8 +2297,7 @@ PP(pp_negate) { dTOPss; const int flags = SvFLAGS(sv); - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if ((flags & SVf_IOK) || ((flags & (SVp_IOK | SVp_NOK)) == SVp_IOK)) { /* It's publicly an integer, or privately an integer-not-float */ oops_its_an_int: @@ -2376,8 +2373,7 @@ PP(pp_complement) dSP; dTARGET; tryAMAGICun(compl); { dTOPss; - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (SvNIOKp(sv)) { if (PL_op->op_private & HINT_INTEGER) { const IV i = ~SvIV_nomg(sv); @@ -1126,10 +1126,8 @@ PP(pp_flop) if (GIMME == G_ARRAY) { dPOPPOPssrl; - if (SvGMAGICAL(left)) - mg_get(left); - if (SvGMAGICAL(right)) - mg_get(right); + SvGETMAGIC(left); + SvGETMAGIC(right); if (RANGE_IS_NUMERIC(left,right)) { register IV i, j; @@ -1543,8 +1541,7 @@ PP(pp_dorassign) RETURN; break; default: - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (SvOK(sv)) RETURN; } @@ -169,8 +169,7 @@ PP(pp_concat) } else { /* TARG == left */ STRLEN llen; - if (SvGMAGICAL(left)) - mg_get(left); /* or mg_get(left) may happen here */ + SvGETMAGIC(left); /* or mg_get(left) may happen here */ if (!SvOK(TARG)) sv_setpvn(left, "", 0); (void)SvPV_nomg_const(left, llen); /* Needed to set UTF8 flag */ @@ -350,8 +349,7 @@ PP(pp_dor) RETURN; break; default: - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (SvOK(sv)) RETURN; } @@ -2914,8 +2912,7 @@ PP(pp_aelem) void Perl_vivify_ref(pTHX_ SV *sv, U32 to_what) { - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (!SvOK(sv)) { if (SvREADONLY(sv)) Perl_croak(aTHX_ PL_no_modify); @@ -2985,8 +2982,7 @@ S_method_common(pTHX_ SV* meth, U32* hashp) if (!sv) Perl_croak(aTHX_ "Can't call method \"%s\" on an undefined value", name); - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (SvROK(sv)) ob = (SV*)SvRV(sv); else { @@ -3443,8 +3443,7 @@ sv_true() or its macro equivalent. bool Perl_sv_2bool(pTHX_ register SV *sv) { - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (!SvOK(sv)) return 0; @@ -6877,8 +6876,7 @@ Perl_sv_inc(pTHX_ register SV *sv) if (!sv) return; - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (SvTHINKFIRST(sv)) { if (SvIsCOW(sv)) sv_force_normal_flags(sv, 0); @@ -7033,8 +7031,7 @@ Perl_sv_dec(pTHX_ register SV *sv) if (!sv) return; - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (SvTHINKFIRST(sv)) { if (SvIsCOW(sv)) sv_force_normal_flags(sv, 0); @@ -7687,8 +7684,7 @@ Perl_sv_2cv(pTHX_ SV *sv, HV **st, GV **gvp, I32 lref) goto fix_gv; default: - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (SvROK(sv)) { SV **sp = &sv; /* Used in tryAMAGICunDEREF macro. */ tryAMAGICunDEREF(to_cv); @@ -8121,8 +8117,7 @@ Perl_sv_isobject(pTHX_ SV *sv) { if (!sv) return 0; - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (!SvROK(sv)) return 0; sv = (SV*)SvRV(sv); @@ -8147,8 +8142,7 @@ Perl_sv_isa(pTHX_ SV *sv, const char *name) const char *hvname; if (!sv) return 0; - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (!SvROK(sv)) return 0; sv = (SV*)SvRV(sv); diff --git a/universal.c b/universal.c index 4506f77b6f..0c29d9312b 100644 --- a/universal.c +++ b/universal.c @@ -144,8 +144,7 @@ Perl_sv_derived_from(pTHX_ SV *sv, const char *name) HV *stash = Nullhv; HV *name_stash; - if (SvGMAGICAL(sv)) - mg_get(sv) ; + SvGETMAGIC(sv); if (SvROK(sv)) { sv = SvRV(sv); @@ -262,8 +261,7 @@ XS(XS_UNIVERSAL_isa) sv = ST(0); - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (!SvOK(sv) || !(SvROK(sv) || (SvPOK(sv) && SvCUR(sv)) || (SvGMAGICAL(sv) && SvPOKp(sv) && SvCUR(sv)))) @@ -288,8 +286,7 @@ XS(XS_UNIVERSAL_can) sv = ST(0); - if (SvGMAGICAL(sv)) - mg_get(sv); + SvGETMAGIC(sv); if (!SvOK(sv) || !(SvROK(sv) || (SvPOK(sv) && SvCUR(sv)) || (SvGMAGICAL(sv) && SvPOKp(sv) && SvCUR(sv)))) @@ -305,8 +305,7 @@ usage: rv = ST(0); ST(0) = TARG; - if (SvGMAGICAL(rv)) - mg_get(rv); + SvGETMAGIC(rv); if (!(SvOK(rv) && SvROK(rv))) goto usage; sv = SvRV(rv); |