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 /sv.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 'sv.c')
-rw-r--r-- | sv.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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)) |