summaryrefslogtreecommitdiff
path: root/mro.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-09-20 09:42:50 +0000
committerNicholas Clark <nick@ccl4.org>2007-09-20 09:42:50 +0000
commit73968c7a3e8deb8ff839b220f53356c001f4e89a (patch)
tree6333b2a236914924f9a256eb17a079b5dc4d67cb /mro.c
parent48e1361cf2222b49db181701bdd28356903d46d7 (diff)
downloadperl-73968c7a3e8deb8ff839b220f53356c001f4e89a.tar.gz
SVs know their length, so avoid 2 calls to strlen().
As we have an SV, call hv_fetch_ent() rather than hv_fetch(). p4raw-id: //depot/perl@31921
Diffstat (limited to 'mro.c')
-rw-r--r--mro.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/mro.c b/mro.c
index 8634ccb3eb..58aca00aa4 100644
--- a/mro.c
+++ b/mro.c
@@ -779,10 +779,8 @@ XS(XS_mro_get_isarev)
dVAR;
dXSARGS;
SV* classname;
- SV** svp;
+ HE* he;
HV* isarev;
- char* classname_pv;
- STRLEN classname_len;
AV* ret_array;
PERL_UNUSED_ARG(cv);
@@ -795,10 +793,8 @@ XS(XS_mro_get_isarev)
SP -= items;
- classname_pv = SvPV_nolen(classname);
- classname_len = strlen(classname_pv);
- svp = hv_fetch(PL_isarev, classname_pv, classname_len, 0);
- isarev = svp ? (HV*)*svp : NULL;
+ he = hv_fetch_ent(PL_isarev, classname, 0, 0);
+ isarev = he ? (HV*)HeVAL(he) : NULL;
ret_array = newAV();
if(isarev) {
@@ -821,7 +817,7 @@ XS(XS_mro_is_universal)
HV* isarev;
char* classname_pv;
STRLEN classname_len;
- SV** svp;
+ HE* he;
PERL_UNUSED_ARG(cv);
@@ -833,8 +829,8 @@ XS(XS_mro_is_universal)
classname_pv = SvPV_nolen(classname);
classname_len = strlen(classname_pv);
- svp = hv_fetch(PL_isarev, classname_pv, classname_len, 0);
- isarev = svp ? (HV*)*svp : NULL;
+ he = hv_fetch_ent(PL_isarev, classname, 0, 0);
+ isarev = he ? (HV*)HeVAL(he) : NULL;
if((classname_len == 9 && strEQ(classname_pv, "UNIVERSAL"))
|| (isarev && hv_exists(isarev, "UNIVERSAL", 9)))