summaryrefslogtreecommitdiff
path: root/mro.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-10-08 06:38:29 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-10-08 13:06:39 -0700
commit090c3c371910e06ac0c1a1cffa612da15d68c728 (patch)
tree64660cc2aaa094843faf10eefc5f276f74cf6698 /mro.c
parent218fa151b7edc486a27eb8ece21cda2538edf177 (diff)
downloadperl-090c3c371910e06ac0c1a1cffa612da15d68c728.tar.gz
mro.c:S_gather_and_rename: Avoid extra SVs
Diffstat (limited to 'mro.c')
-rw-r--r--mro.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/mro.c b/mro.c
index 1d60387869..386f898984 100644
--- a/mro.c
+++ b/mro.c
@@ -1088,21 +1088,19 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes,
/* Iterate through the entries in this list */
for(; entry; entry = HeNEXT(entry)) {
- SV* keysv;
const char* key;
- STRLEN len;
+ I32 len;
/* If this entry is not a glob, ignore it.
Try the next. */
if (!isGV(HeVAL(entry))) continue;
- keysv = hv_iterkeysv(entry);
- key = SvPV_const(keysv, len);
+ key = hv_iterkey(entry, &len);
if ((len > 1 && key[len-2] == ':' && key[len-1] == ':')
|| (len == 1 && key[0] == ':')) {
HV * const oldsubstash = GvHV(HeVAL(entry));
SV ** const stashentry
- = stash ? hv_fetch(stash, key, SvUTF8(keysv) ? -(I32)len : (I32)len, 0) : NULL;
+ = stash ? hv_fetch(stash, key, HeUTF8(entry) ? -(I32)len : (I32)len, 0) : NULL;
HV *substash = NULL;
/* Avoid main::main::main::... */
@@ -1132,7 +1130,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes,
sv_catpvs(aname, "::");
sv_catpvn_flags(
aname, key, len-2,
- SvUTF8(keysv)
+ HeUTF8(entry)
? SV_CATUTF8 : SV_CATBYTES
);
}
@@ -1146,7 +1144,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes,
sv_catpvs(subname, "::");
sv_catpvn_flags(
subname, key, len-2,
- SvUTF8(keysv) ? SV_CATUTF8 : SV_CATBYTES
+ HeUTF8(entry) ? SV_CATUTF8 : SV_CATBYTES
);
}
}
@@ -1156,7 +1154,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes,
);
}
- (void)hv_store(seen, key, SvUTF8(keysv) ? -(I32)len : (I32)len, &PL_sv_yes, 0);
+ (void)hv_store(seen, key, HeUTF8(entry) ? -(I32)len : (I32)len, &PL_sv_yes, 0);
}
}
}
@@ -1174,23 +1172,21 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes,
/* Iterate through the entries in this list */
for(; entry; entry = HeNEXT(entry)) {
- SV* keysv;
const char* key;
- STRLEN len;
+ I32 len;
/* If this entry is not a glob, ignore it.
Try the next. */
if (!isGV(HeVAL(entry))) continue;
- keysv = hv_iterkeysv(entry);
- key = SvPV_const(keysv, len);
+ key = hv_iterkey(entry, &len);
if ((len > 1 && key[len-2] == ':' && key[len-1] == ':')
|| (len == 1 && key[0] == ':')) {
HV *substash;
/* If this entry was seen when we iterated through the
oldstash, skip it. */
- if(seen && hv_exists(seen, key, SvUTF8(keysv) ? -(I32)len : (I32)len)) continue;
+ if(seen && hv_exists(seen, key, HeUTF8(entry) ? -(I32)len : (I32)len)) continue;
/* We get here only if this stash has no corresponding
entry in the stash being replaced. */
@@ -1217,7 +1213,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes,
sv_catpvs(aname, "::");
sv_catpvn_flags(
aname, key, len-2,
- SvUTF8(keysv)
+ HeUTF8(entry)
? SV_CATUTF8 : SV_CATBYTES
);
}
@@ -1231,7 +1227,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes,
sv_catpvs(subname, "::");
sv_catpvn_flags(
subname, key, len-2,
- SvUTF8(keysv) ? SV_CATUTF8 : SV_CATBYTES
+ HeUTF8(entry) ? SV_CATUTF8 : SV_CATBYTES
);
}
}