diff options
author | Karl Williamson <khw@cpan.org> | 2017-10-31 08:30:38 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2017-11-06 12:50:05 -0700 |
commit | b59bf0b2884b21b6f3ce5eca607ab7a6096d87f5 (patch) | |
tree | 8f7f056070732c24842887baa1d18b6a54a9f7d1 /mro_core.c | |
parent | c8b388b0c776dab4a28db03739aff4d64daccada (diff) | |
download | perl-b59bf0b2884b21b6f3ce5eca607ab7a6096d87f5.tar.gz |
Use memEQs, memNEs in core files
Where the length is known, we can use these functions which relieve
the programmer and the program reader from having to count characters.
The memFOO functions should also be slightly faster than the strFOO
equivalents.
In some instances in this commit, hard coded numbers are used. These
come from the 'case' statement values that apply to them.
Diffstat (limited to 'mro_core.c')
-rw-r--r-- | mro_core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mro_core.c b/mro_core.c index d1abc28b72..cf7768f6c8 100644 --- a/mro_core.c +++ b/mro_core.c @@ -790,7 +790,7 @@ Perl_mro_package_moved(pTHX_ HV * const stash, HV * const oldstash, if (name_count < 0) ++namep, name_count = -name_count - 1; } if (name_count == 1) { - if (HEK_LEN(*namep) == 4 && strnEQ(HEK_KEY(*namep), "main", 4)) { + if (memEQs(HEK_KEY(*namep), HEK_LEN(*namep), "main")) { namesv = GvNAMELEN(gv) == 1 ? newSVpvs_flags(":", SVs_TEMP) : newSVpvs_flags("", SVs_TEMP); @@ -812,7 +812,7 @@ Perl_mro_package_moved(pTHX_ HV * const stash, HV * const oldstash, SV *aname; namesv = sv_2mortal((SV *)newAV()); while (name_count--) { - if(HEK_LEN(*namep) == 4 && strnEQ(HEK_KEY(*namep), "main", 4)){ + if(memEQs(HEK_KEY(*namep), HEK_LEN(*namep), "main")){ aname = GvNAMELEN(gv) == 1 ? newSVpvs(":") : newSVpvs(""); |