summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2017-10-31 08:30:38 -0600
committerKarl Williamson <khw@cpan.org>2017-11-06 12:50:05 -0700
commitb59bf0b2884b21b6f3ce5eca607ab7a6096d87f5 (patch)
tree8f7f056070732c24842887baa1d18b6a54a9f7d1 /sv.c
parentc8b388b0c776dab4a28db03739aff4d64daccada (diff)
downloadperl-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 'sv.c')
-rw-r--r--sv.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sv.c b/sv.c
index 8e54364dc9..1e173ed48e 100644
--- a/sv.c
+++ b/sv.c
@@ -3919,15 +3919,14 @@ S_glob_assign_glob(pTHX_ SV *const dstr, SV *const sstr, const int dtype)
glob to begin with. */
if(dtype == SVt_PVGV) {
const char * const name = GvNAME((const GV *)dstr);
- if(
- strEQ(name,"ISA")
+ const STRLEN len = GvNAMELEN(dstr);
+ if(memEQs(name, len, "ISA")
/* The stash may have been detached from the symbol table, so
check its name. */
&& GvSTASH(dstr) && HvENAME(GvSTASH(dstr))
)
mro_changes = 2;
else {
- const STRLEN len = GvNAMELEN(dstr);
if ((len > 1 && name[len-2] == ':' && name[len-1] == ':')
|| (len == 1 && name[0] == ':')) {
mro_changes = 3;
@@ -4140,7 +4139,7 @@ Perl_gv_setref(pTHX_ SV *const dstr, SV *const sstr)
}
else if (
stype == SVt_PVAV && sref != dref
- && strEQ(GvNAME((GV*)dstr), "ISA")
+ && memEQs(GvNAME((GV*)dstr), GvNAMELEN((GV*)dstr), "ISA")
/* The stash may have been detached from the symbol table, so
check its name before doing anything. */
&& GvSTASH(dstr) && HvENAME(GvSTASH(dstr))