summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2016-08-12 08:37:37 -0700
committerFather Chrysostomos <sprout@cpan.org>2016-08-12 08:39:46 -0700
commitee33cc1af47fcf535fa762422a110c2782c45935 (patch)
treea630a688115843d34aae9f310118dfe8c389a58d /gv.c
parentbeb162121766004ac91b7bcb84a59a1402fe1634 (diff)
downloadperl-ee33cc1af47fcf535fa762422a110c2782c45935.tar.gz
gv.c:require_tie_mod: Make var name a char param
This reduces machine code size a little and simplifies require_tie_mod. On a non-debugging Linux GCC build with -O2: Before: $ ls -l gv.o -rw-r--r-- 1 sprout p5p 88704 Aug 12 07:29 gv.o After: $ ls -l gv.o -rw-r--r-- 1 sprout p5p 88656 Aug 12 17:29 gv.o
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/gv.c b/gv.c
index e24a193211..1bc8bf2d9d 100644
--- a/gv.c
+++ b/gv.c
@@ -1298,19 +1298,16 @@ Perl_gv_autoload_pvn(pTHX_ HV *stash, const char *name, STRLEN len, U32 flags)
* with the passed gv as an argument.
*
* The "gv" parameter should be the glob.
- * "varpv" holds the name of the var, used for error messages.
+ * "varname" holds the 1-char name of the var, used for error messages.
* "namesv" holds the module name. Its refcount will be decremented.
* "flags": if flag & 1 then save the scalar before loading.
* For the protection of $! to work (it is set by this routine)
* the sv slot must already be magicalized.
*/
STATIC void
-S_require_tie_mod(pTHX_ GV *gv, const char *varpv, const char * name,
+S_require_tie_mod(pTHX_ GV *gv, const char varname, const char * name,
STRLEN len, const U32 flags)
{
- const char varname = *varpv; /* varpv might be clobbered by
- load_module, so save it. For the
- moment it’s always a single char. */
const SV * const target = varname == '[' ? GvSV(gv) : (SV *)GvHV(gv);
PERL_ARGS_ASSERT_REQUIRE_TIE_MOD;
@@ -2080,7 +2077,7 @@ S_gv_magicalize(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len,
/* magicalization must be done before require_tie_mod is called */
if (sv_type == SVt_PVHV || sv_type == SVt_PVGV)
- require_tie_mod(gv, "!", "Errno", 5, 1);
+ require_tie_mod(gv, '!', "Errno", 5, 1);
break;
case '-': /* $- */
@@ -2097,7 +2094,7 @@ S_gv_magicalize(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len,
SvREADONLY_on(av);
if (sv_type == SVt_PVHV || sv_type == SVt_PVGV)
- require_tie_mod(gv, name, "Tie::Hash::NamedCapture",23, 0);
+ require_tie_mod(gv, *name, "Tie::Hash::NamedCapture",23,0);
break;
}
@@ -2117,7 +2114,7 @@ S_gv_magicalize(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len,
case '[': /* $[ */
if ((sv_type == SVt_PV || sv_type == SVt_PVGV)
&& FEATURE_ARYBASE_IS_ENABLED) {
- require_tie_mod(gv,name,"arybase",7,0);
+ require_tie_mod(gv,'[',"arybase",7,0);
}
else goto magicalize;
break;
@@ -2211,9 +2208,9 @@ S_maybe_multimagic_gv(pTHX_ GV *gv, const char *name, const svtype sv_type)
if (sv_type == SVt_PVHV || sv_type == SVt_PVGV) {
if (*name == '!')
- require_tie_mod(gv, "!", "Errno", 5, 1);
+ require_tie_mod(gv, '!', "Errno", 5, 1);
else if (*name == '-' || *name == '+')
- require_tie_mod(gv, name, "Tie::Hash::NamedCapture", 23, 0);
+ require_tie_mod(gv, *name, "Tie::Hash::NamedCapture", 23, 0);
} else if (sv_type == SVt_PV) {
if (*name == '*' || *name == '#') {
/* diag_listed_as: $* is no longer supported */
@@ -2225,7 +2222,7 @@ S_maybe_multimagic_gv(pTHX_ GV *gv, const char *name, const svtype sv_type)
if (sv_type==SVt_PV || sv_type==SVt_PVGV) {
switch (*name) {
case '[':
- require_tie_mod(gv,name,"arybase",7,0);
+ require_tie_mod(gv,'[',"arybase",7,0);
break;
#ifdef PERL_SAWAMPERSAND
case '`':