diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-09-08 20:45:20 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-09-08 21:36:40 -0700 |
commit | 77cb3b015781b8e3c7ee73c313ba18cd16dfb442 (patch) | |
tree | b5b8ecc07baf116844af218e14590a0c655af2f3 /pp_hot.c | |
parent | b1b24ee7afadda660049b2e5ed5e566d8d3babbc (diff) | |
download | perl-77cb3b015781b8e3c7ee73c313ba18cd16dfb442.tar.gz |
Enter gv_fetchsv_nomg
There are so many cases that use this incantation to get around
gv_fetchsv’s calling of get-magic--
STRLEN len;
const char *name = SvPV_nomg_const(sv,len);
gv = gv_fetchpvn_flags(name, len, flags | SvUTF8(sv), type);
--that it’s about time we had a shorthand.
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -125,8 +125,6 @@ PP(pp_sassign) const U32 cv_type = SvTYPE(cv); const bool is_gv = isGV_with_GP(right); const bool got_coderef = cv_type == SVt_PVCV || cv_type == SVt_PVFM; - STRLEN len = 0; - const char *nambeg = is_gv ? NULL : SvPV_nomg_const(right, len); if (!got_coderef) { assert(SvROK(cv)); @@ -137,9 +135,7 @@ PP(pp_sassign) context. */ if (!got_coderef && !is_gv && GIMME_V == G_VOID) { /* Is the target symbol table currently empty? */ - GV * const gv = gv_fetchpvn_flags( - nambeg, len, SvUTF8(right)|GV_NOINIT, SVt_PVGV - ); + GV * const gv = gv_fetchsv_nomg(right, GV_NOINIT, SVt_PVGV); if (SvTYPE(gv) != SVt_PVGV && !SvOK(gv)) { /* Good. Create a new proxy constant subroutine in the target. The gv becomes a(nother) reference to the constant. */ @@ -157,9 +153,7 @@ PP(pp_sassign) /* Need to fix things up. */ if (!is_gv) { /* Need to fix GV. */ - right = MUTABLE_SV(gv_fetchpvn_flags( - nambeg, len, SvUTF8(right)|GV_ADD, SVt_PVGV - )); + right = MUTABLE_SV(gv_fetchsv_nomg(right,GV_ADD, SVt_PVGV)); } if (!got_coderef) { |