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 | |
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.
-rw-r--r-- | ext/XS-APItest/APItest.xs | 41 | ||||
-rw-r--r-- | ext/attributes/attributes.xs | 6 | ||||
-rw-r--r-- | gv.c | 18 | ||||
-rw-r--r-- | hv.c | 2 | ||||
-rw-r--r-- | mro_core.c | 4 | ||||
-rw-r--r-- | numeric.c | 2 | ||||
-rw-r--r-- | op.c | 2 | ||||
-rw-r--r-- | pp_ctl.c | 2 | ||||
-rw-r--r-- | regcomp.c | 10 | ||||
-rw-r--r-- | scope.c | 6 | ||||
-rw-r--r-- | sv.c | 7 | ||||
-rw-r--r-- | toke.c | 18 | ||||
-rw-r--r-- | utf8.c | 14 | ||||
-rw-r--r-- | vms/vms.c | 12 |
14 files changed, 63 insertions, 81 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs index 112e2ac41c..fa11b05fdc 100644 --- a/ext/XS-APItest/APItest.xs +++ b/ext/XS-APItest/APItest.xs @@ -1161,84 +1161,83 @@ static int THX_keyword_active(pTHX_ SV *hintkey_sv) static int my_keyword_plugin(pTHX_ char *keyword_ptr, STRLEN keyword_len, OP **op_ptr) { - if(keyword_len == 3 && strBEGINs(keyword_ptr, "rpn") && + if (memEQs(keyword_ptr, keyword_len, "rpn") && keyword_active(hintkey_rpn_sv)) { *op_ptr = parse_keyword_rpn(); return KEYWORD_PLUGIN_EXPR; - } else if(keyword_len == 7 && strBEGINs(keyword_ptr, "calcrpn") && + } else if (memEQs(keyword_ptr, keyword_len, "calcrpn") && keyword_active(hintkey_calcrpn_sv)) { *op_ptr = parse_keyword_calcrpn(); return KEYWORD_PLUGIN_STMT; - } else if(keyword_len == 9 && strBEGINs(keyword_ptr, "stufftest") && + } else if (memEQs(keyword_ptr, keyword_len, "stufftest") && keyword_active(hintkey_stufftest_sv)) { *op_ptr = parse_keyword_stufftest(); return KEYWORD_PLUGIN_STMT; - } else if(keyword_len == 12 && - strBEGINs(keyword_ptr, "swaptwostmts") && + } else if (memEQs(keyword_ptr, keyword_len, "swaptwostmts") && keyword_active(hintkey_swaptwostmts_sv)) { *op_ptr = parse_keyword_swaptwostmts(); return KEYWORD_PLUGIN_STMT; - } else if(keyword_len == 8 && strBEGINs(keyword_ptr, "looprest") && + } else if (memEQs(keyword_ptr, keyword_len, "looprest") && keyword_active(hintkey_looprest_sv)) { *op_ptr = parse_keyword_looprest(); return KEYWORD_PLUGIN_STMT; - } else if(keyword_len == 14 && strBEGINs(keyword_ptr, "scopelessblock") && + } else if (memEQs(keyword_ptr, keyword_len, "scopelessblock") && keyword_active(hintkey_scopelessblock_sv)) { *op_ptr = parse_keyword_scopelessblock(); return KEYWORD_PLUGIN_STMT; - } else if(keyword_len == 10 && strBEGINs(keyword_ptr, "stmtasexpr") && + } else if (memEQs(keyword_ptr, keyword_len, "stmtasexpr") && keyword_active(hintkey_stmtasexpr_sv)) { *op_ptr = parse_keyword_stmtasexpr(); return KEYWORD_PLUGIN_EXPR; - } else if(keyword_len == 11 && strBEGINs(keyword_ptr, "stmtsasexpr") && + } else if (memEQs(keyword_ptr, keyword_len, "stmtsasexpr") && keyword_active(hintkey_stmtsasexpr_sv)) { *op_ptr = parse_keyword_stmtsasexpr(); return KEYWORD_PLUGIN_EXPR; - } else if(keyword_len == 9 && strBEGINs(keyword_ptr, "loopblock") && + } else if (memEQs(keyword_ptr, keyword_len, "loopblock") && keyword_active(hintkey_loopblock_sv)) { *op_ptr = parse_keyword_loopblock(); return KEYWORD_PLUGIN_STMT; - } else if(keyword_len == 11 && strBEGINs(keyword_ptr, "blockasexpr") && + } else if (memEQs(keyword_ptr, keyword_len, "blockasexpr") && keyword_active(hintkey_blockasexpr_sv)) { *op_ptr = parse_keyword_blockasexpr(); return KEYWORD_PLUGIN_EXPR; - } else if(keyword_len == 9 && strBEGINs(keyword_ptr, "swaplabel") && + } else if (memEQs(keyword_ptr, keyword_len, "swaplabel") && keyword_active(hintkey_swaplabel_sv)) { *op_ptr = parse_keyword_swaplabel(); return KEYWORD_PLUGIN_STMT; - } else if(keyword_len == 10 && strBEGINs(keyword_ptr, "labelconst") && + } else if (memEQs(keyword_ptr, keyword_len, "labelconst") && keyword_active(hintkey_labelconst_sv)) { *op_ptr = parse_keyword_labelconst(); return KEYWORD_PLUGIN_EXPR; - } else if(keyword_len == 13 && strBEGINs(keyword_ptr, "arrayfullexpr") && + } else if (memEQs(keyword_ptr, keyword_len, "arrayfullexpr") && keyword_active(hintkey_arrayfullexpr_sv)) { *op_ptr = parse_keyword_arrayfullexpr(); return KEYWORD_PLUGIN_EXPR; - } else if(keyword_len == 13 && strBEGINs(keyword_ptr, "arraylistexpr") && + } else if (memEQs(keyword_ptr, keyword_len, "arraylistexpr") && keyword_active(hintkey_arraylistexpr_sv)) { *op_ptr = parse_keyword_arraylistexpr(); return KEYWORD_PLUGIN_EXPR; - } else if(keyword_len == 13 && strBEGINs(keyword_ptr, "arraytermexpr") && + } else if (memEQs(keyword_ptr, keyword_len, "arraytermexpr") && keyword_active(hintkey_arraytermexpr_sv)) { *op_ptr = parse_keyword_arraytermexpr(); return KEYWORD_PLUGIN_EXPR; - } else if(keyword_len == 14 && strBEGINs(keyword_ptr, "arrayarithexpr") && + } else if (memEQs(keyword_ptr, keyword_len, "arrayarithexpr") && keyword_active(hintkey_arrayarithexpr_sv)) { *op_ptr = parse_keyword_arrayarithexpr(); return KEYWORD_PLUGIN_EXPR; - } else if(keyword_len == 14 && strBEGINs(keyword_ptr, "arrayexprflags") && + } else if (memEQs(keyword_ptr, keyword_len, "arrayexprflags") && keyword_active(hintkey_arrayexprflags_sv)) { *op_ptr = parse_keyword_arrayexprflags(); return KEYWORD_PLUGIN_EXPR; - } else if(keyword_len == 5 && strBEGINs(keyword_ptr, "DEFSV") && + } else if (memEQs(keyword_ptr, keyword_len, "DEFSV") && keyword_active(hintkey_DEFSV_sv)) { *op_ptr = parse_keyword_DEFSV(); return KEYWORD_PLUGIN_EXPR; - } else if(keyword_len == 9 && strBEGINs(keyword_ptr, "with_vars") && + } else if (memEQs(keyword_ptr, keyword_len, "with_vars") && keyword_active(hintkey_with_vars_sv)) { *op_ptr = parse_keyword_with_vars(); return KEYWORD_PLUGIN_STMT; - } else if(keyword_len == 15 && strBEGINs(keyword_ptr, "join_with_space") && + } else if (memEQs(keyword_ptr, keyword_len, "join_with_space") && keyword_active(hintkey_join_with_space_sv)) { *op_ptr = parse_join_with_space(); return KEYWORD_PLUGIN_EXPR; diff --git a/ext/attributes/attributes.xs b/ext/attributes/attributes.xs index 605749a010..fa0b72abfc 100644 --- a/ext/attributes/attributes.xs +++ b/ext/attributes/attributes.xs @@ -44,7 +44,7 @@ modify_SV_attributes(pTHX_ SV *sv, SV **retlist, SV **attrlist, int numattrs) case SVt_PVCV: switch ((int)len) { case 5: - if (_memEQs(name, "const")) { + if (memEQs(name, 5, "const")) { if (negated) CvANONCONST_off(sv); else { @@ -60,7 +60,7 @@ modify_SV_attributes(pTHX_ SV *sv, SV **retlist, SV **attrlist, int numattrs) case 6: switch (name[3]) { case 'l': - if (_memEQs(name, "lvalue")) { + if (memEQs(name, 6, "lvalue")) { bool warn = !CvISXSUB(MUTABLE_CV(sv)) && CvROOT(MUTABLE_CV(sv)) @@ -74,7 +74,7 @@ modify_SV_attributes(pTHX_ SV *sv, SV **retlist, SV **attrlist, int numattrs) } break; case 'h': - if (_memEQs(name, "method")) { + if (memEQs(name, 6, "method")) { if (negated) CvFLAGS(MUTABLE_CV(sv)) &= ~CVf_METHOD; else @@ -83,8 +83,8 @@ Perl_gv_add_by_type(pTHX_ GV *gv, svtype type) if (!*where) { *where = newSV_type(type); - if (type == SVt_PVAV && GvNAMELEN(gv) == 3 - && strBEGINs(GvNAME(gv), "ISA")) + if (type == SVt_PVAV + && memEQs(GvNAME(gv), GvNAMELEN(gv), "ISA")) sv_magic(*where, (SV *)gv, PERL_MAGIC_isa, NULL, 0); } return gv; @@ -780,8 +780,8 @@ S_gv_fetchmeth_internal(pTHX_ HV* stash, SV* meth, const char* name, STRLEN len, return 0; } else if (stash == cachestash - && len > 1 /* shortest is uc */ && HvNAMELEN_get(stash) == 4 - && strBEGINs(hvname, "CORE") + && len > 1 /* shortest is uc */ + && memEQs(hvname, HvNAMELEN_get(stash), "CORE") && S_maybe_add_coresub(aTHX_ NULL,topgv,name,len)) goto have_gv; } @@ -2410,8 +2410,8 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, if (len == 1 && stash == PL_defstash) { maybe_multimagic_gv(gv, name, sv_type); } - else if (len == 3 && sv_type == SVt_PVAV - && strBEGINs(name, "ISA") + else if (sv_type == SVt_PVAV + && memEQs(name, len, "ISA") && (!GvAV(gv) || !SvSMAGICAL(GvAV(gv)))) gv_magicalize_isa(gv); } @@ -2816,9 +2816,9 @@ Perl_Gv_AMupdate(pTHX_ HV *stash, bool destructing) const HEK * const gvhek = CvGvNAME_HEK(cv); const HEK * const stashek = HvNAME_HEK(CvNAMED(cv) ? CvSTASH(cv) : GvSTASH(CvGV(cv))); - if (HEK_LEN(gvhek) == 3 && strEQ(HEK_KEY(gvhek), "nil") - && stashek && HEK_LEN(stashek) == 8 - && strEQ(HEK_KEY(stashek), "overload")) { + if (memEQs(HEK_KEY(gvhek), HEK_LEN(gvhek), "nil") + && stashek + && memEQs(HEK_KEY(stashek), HEK_LEN(stashek), "overload")) { /* This is a hack to support autoloading..., while knowing *which* methods were declared as overloaded. */ /* GvSV contains the name of the method. */ @@ -1279,7 +1279,7 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, sv_2mortal((SV *)gv) ); } - else if (klen == 3 && strBEGINs(key, "ISA") && GvAV(gv)) { + else if (memEQs(key, klen, "ISA") && GvAV(gv)) { AV *isa = GvAV(gv); MAGIC *mg = mg_find((SV*)isa, PERL_MAGIC_isa); 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(""); @@ -1013,7 +1013,7 @@ Perl_grok_number_flags(pTHX_ const char *pv, STRLEN len, UV *valuep, U32 flags) s++; if (s >= send) return numtype; - if (len == 10 && _memEQs(pv, "0 but true")) { + if (memEQs(pv, len, "0 but true")) { if (valuep) *valuep = 0; return IS_NUMBER_IN_UV; @@ -11825,7 +11825,7 @@ Perl_ck_method(pTHX_ OP *o) return newMETHOP_named(OP_METHOD_NAMED, 0, methsv); } - if (nsplit == 7 && memEQ(method, "SUPER::", nsplit)) { /* $proto->SUPER::method() */ + if (memEQs(method, nsplit, "SUPER::")) { /* $proto->SUPER::method() */ op_free(o); return newMETHOP_named(OP_METHOD_SUPER, 0, methsv); } @@ -3849,7 +3849,7 @@ S_require_file(pTHX_ SV *sv) directory, or (*nix) hidden filenames. Also sanity check that the generated filename ends .pm */ if (!path_searchable || len < 3 || name[0] == '.' - || !memEQ(name + package_len, ".pm", 3)) + || !memEQs(name + package_len, len - package_len, ".pm")) DIE(aTHX_ "Bareword in require maps to disallowed filename \"%" SVf "\"", sv); if (memchr(name, 0, package_len)) { /* diag_listed_as: Bareword in require contains "%s" */ @@ -12794,8 +12794,8 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth) }*/ switch (*RExC_parse) { case 'g': - if (length != 1 - && (length != 3 || strnNE(RExC_parse + 1, "cb", 2))) + if ( length != 1 + && (memNEs(RExC_parse + 1, length - 1, "cb"))) { goto bad_bound_type; } @@ -14616,7 +14616,7 @@ S_handle_possible_posix(pTHX_ RExC_state_t *pRExC_state, * */ switch (name_len) { case 4: - if (memEQ(name_start, "word", 4)) { + if (memEQs(name_start, 4, "word")) { /* this is not POSIX, this is the Perl \w */ class_number = ANYOF_WORDCHAR; } @@ -14671,7 +14671,7 @@ S_handle_possible_posix(pTHX_ RExC_state_t *pRExC_state, } break; case 6: - if (memEQ(name_start, "xdigit", 6)) + if (memEQs(name_start, 6, "xdigit")) class_number = ANYOF_XDIGIT; break; } @@ -16440,7 +16440,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth, * referred to outside it. [perl #121777] */ if (! has_pkg && curpkg) { char* pkgname = HvNAME(curpkg); - if (strNE(pkgname, "main")) { + if (memNEs(pkgname, HvNAMELEN(curpkg), "main")) { char* full_name = Perl_form(aTHX_ "%s::%s", pkgname, @@ -349,7 +349,7 @@ Perl_save_gp(pTHX_ GV *gv, I32 empty) bool isa_changed = 0; if (stash && HvENAME(stash)) { - if (GvNAMELEN(gv) == 3 && strnEQ(GvNAME(gv), "ISA", 3)) + if (memEQs(GvNAME(gv), GvNAMELEN(gv), "ISA")) isa_changed = TRUE; else if (GvCVu(gv)) /* taking a method out of circulation ("local")*/ @@ -1091,9 +1091,7 @@ Perl_leave_scope(pTHX_ I32 base) gp_free(a0.any_gv); GvGP_set(a0.any_gv, (GP*)a1.any_ptr); if ((hv=GvSTASH(a0.any_gv)) && HvENAME_get(hv)) { - if ( GvNAMELEN(a0.any_gv) == 3 - && strnEQ(GvNAME(a0.any_gv), "ISA", 3) - ) + if (memEQs(GvNAME(a0.any_gv), GvNAMELEN(a0.any_gv), "ISA")) mro_isa_changed_in(hv); else if (had_method || GvCVu(a0.any_gv)) /* putting a method back into circulation ("local")*/ @@ -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)) @@ -2618,8 +2618,7 @@ S_get_and_check_backslash_N_name(pTHX_ const char* s, const char* const e) SvTYPE(rv) == SVt_PVCV) && ((stash = CvSTASH(rv)) != NULL)) { const char * const name = HvNAME(stash); - if (HvNAMELEN(stash) == sizeof("_charnames")-1 - && strEQ(name, "_charnames")) { + if (memEQs(name, HvNAMELEN(stash), "_charnames")) { return res; } } @@ -4603,7 +4602,7 @@ S_find_in_my_stash(pTHX_ const char *pkgname, STRLEN len) PERL_ARGS_ASSERT_FIND_IN_MY_STASH; - if (len == 11 && *pkgname == '_' && strEQ(pkgname, "__PACKAGE__")) + if (memEQs(pkgname, len, "__PACKAGE__")) return PL_curstash; if (len > 2 @@ -5950,16 +5949,15 @@ Perl_yylex(pTHX) else { /* NOTE: any CV attrs applied here need to be part of the CVf_BUILTIN_ATTRS define in cv.h! */ - if (!PL_in_my && len == 6 && strnEQ(SvPVX(sv), "lvalue", len)) { + if (!PL_in_my && memEQs(SvPVX(sv), len, "lvalue")) { sv_free(sv); CvLVALUE_on(PL_compcv); } - else if (!PL_in_my && len == 6 && strnEQ(SvPVX(sv), "method", len)) { + else if (!PL_in_my && memEQs(SvPVX(sv), len, "method")) { sv_free(sv); CvMETHOD_on(PL_compcv); } - else if (!PL_in_my && len == 5 - && strnEQ(SvPVX(sv), "const", len)) + else if (!PL_in_my && memEQs(SvPVX(sv), len, "const")) { sv_free(sv); Perl_ck_warner_d(aTHX_ @@ -7048,7 +7046,7 @@ Perl_yylex(pTHX) /* x::* is just a word, unless x is "CORE" */ if (!anydelim && *s == ':' && s[1] == ':') { - if (strEQ(PL_tokenbuf, "CORE")) goto case_KEY_CORE; + if (memEQs(PL_tokenbuf, len, "CORE")) goto case_KEY_CORE; goto just_a_word; } @@ -7821,7 +7819,7 @@ Perl_yylex(pTHX) *PL_tokenbuf = '&'; d = scan_word(s, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, 1, &len); - if (len && (len != 4 || strNE(PL_tokenbuf+1, "CORE")) + if (len && memNEs(PL_tokenbuf+1, len, "CORE") && !keyword(PL_tokenbuf + 1, len, 0)) { SSize_t off = s-SvPVX(PL_linestr); d = skipspace(d); @@ -8199,7 +8197,7 @@ Perl_yylex(pTHX) s = skipspace(s); if (isIDFIRST_lazy_if_safe(s, PL_bufend, UTF)) { s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, TRUE, &len); - if (len == 3 && strBEGINs(PL_tokenbuf, "sub")) + if (memEQs(PL_tokenbuf, len, "sub")) goto really_sub; PL_in_my_stash = find_in_my_stash(PL_tokenbuf, len); if (!PL_in_my_stash) { @@ -3594,17 +3594,12 @@ Perl__to_utf8_fold_flags(pTHX_ const U8 *p, if (flags & FOLD_FLAGS_LOCALE) { # define LONG_S_T LATIN_SMALL_LIGATURE_LONG_S_T_UTF8 - const unsigned int long_s_t_len = sizeof(LONG_S_T) - 1; - # ifdef LATIN_CAPITAL_LETTER_SHARP_S_UTF8 # define CAP_SHARP_S LATIN_CAPITAL_LETTER_SHARP_S_UTF8 - const unsigned int cap_sharp_s_len = sizeof(CAP_SHARP_S) - 1; - /* Special case these two characters, as what normally gets * returned under locale doesn't work */ - if (UTF8SKIP(p) == cap_sharp_s_len - && memEQ((char *) p, CAP_SHARP_S, cap_sharp_s_len)) + if (memEQs((char *) p, UTF8SKIP(p), CAP_SHARP_S)) { /* diag_listed_as: Can't do %s("%s") on non-UTF-8 locale; resolved to "%s". */ Perl_ck_warner(aTHX_ packWARN(WARN_LOCALE), @@ -3614,8 +3609,7 @@ Perl__to_utf8_fold_flags(pTHX_ const U8 *p, } else #endif - if (UTF8SKIP(p) == long_s_t_len - && memEQ((char *) p, LONG_S_T, long_s_t_len)) + if (memEQs((char *) p, UTF8SKIP(p), LONG_S_T)) { /* diag_listed_as: Can't do %s("%s") on non-UTF-8 locale; resolved to "%s". */ Perl_ck_warner(aTHX_ packWARN(WARN_LOCALE), @@ -3634,9 +3628,7 @@ Perl__to_utf8_fold_flags(pTHX_ const U8 *p, * 255/256 boundary which is forbidden under /l, and so the code * wouldn't catch that they are equivalent (which they are only in * this release) */ - else if (UTF8SKIP(p) == sizeof(DOTTED_I) - 1 - && memEQ((char *) p, DOTTED_I, sizeof(DOTTED_I) - 1)) - { + else if (memEQs((char *) p, UTF8SKIP(p), DOTTED_I)) { /* diag_listed_as: Can't do %s("%s") on non-UTF-8 locale; resolved to "%s". */ Perl_ck_warner(aTHX_ packWARN(WARN_LOCALE), "Can't do fc(\"\\x{0130}\") on non-UTF-8 locale; " @@ -1078,7 +1078,7 @@ Perl_my_getenv(pTHX_ const char *lnm, bool sys) } for (cp1 = lnm, cp2 = eqv; *cp1; cp1++,cp2++) *cp2 = toUPPER_A(*cp1); - if (cp1 - lnm == 7 && !strncmp(eqv,"DEFAULT",7)) { + if (memEQs(eqv, cp1 - lnm, "DEFAULT")) { int len; getcwd(eqv,LNM$C_NAMLENGTH); @@ -1174,7 +1174,7 @@ Perl_my_getenv_len(pTHX_ const char *lnm, unsigned long *len, bool sys) } for (cp1 = lnm, cp2 = buf; *cp1; cp1++,cp2++) *cp2 = toUPPER_A(*cp1); - if (cp1 - lnm == 7 && !strncmp(buf,"DEFAULT",7)) { + if (memEQs(buf, cp1 - lnm, "DEFAULT")) { char * zeros; getcwd(buf,LNM$C_NAMLENGTH); @@ -7246,7 +7246,7 @@ int_tounixspec(const char *spec, char *rslt, int * utf8_fl) if (*(cp2+1) == ']' || *(cp2+1) == '>') { while (*(cp2+1) == ']' || *(cp2+1) == '>' || *(cp2+1) == '[' || *(cp2+1) == '<') cp2++; - if (!strncmp(cp2,"[000000",7) && (*(cp2+7) == ']' || + if (memEQs(cp2,"[000000") && (*(cp2+7) == ']' || *(cp2+7) == '>' || *(cp2+7) == '.')) cp2 += 7; } else if ( *(cp2+1) == '.' && *(cp2+2) == '.') { @@ -7990,13 +7990,9 @@ posix_to_vmsspec_hardway(char *vmspath, int vmspath_len, const char *unixpath, nextslash = strchr(&unixptr[1],'/'); seg_len = 0; if (nextslash != NULL) { - int cmp; seg_len = nextslash - &unixptr[1]; my_strlcpy(vmspath, unixptr, seg_len + 2); - cmp = 1; - if (seg_len == 3) { - cmp = strncmp(vmspath, "dev", 4); - if (cmp == 0) { + if (memEQs(vmspath, seg_len, "dev")) { sts = slash_dev_special_to_vms(unixptr, vmspath, vmspath_len); if (sts == SS$_NORMAL) return SS$_NORMAL; |