summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGisle Aas <gisle@activestate.com>2006-01-04 13:53:16 +0000
committerGisle Aas <gisle@activestate.com>2006-01-04 13:53:16 +0000
commit6a245ed1e7ef6f728779f8328fb52e42b1aa0b8c (patch)
tree2b22d2ba828e88be62274986b1e187fcf3861313
parent359e8da2ef248b0ae5eba7c150226268a764452f (diff)
downloadperl-6a245ed1e7ef6f728779f8328fb52e42b1aa0b8c.tar.gz
Get rid of a few more hardcoded string lengths.
p4raw-id: //depot/perl@26645
-rw-r--r--locale.c16
-rw-r--r--mg.c2
-rw-r--r--perl.c2
-rw-r--r--perlio.c10
-rw-r--r--sv.c2
5 files changed, 16 insertions, 16 deletions
diff --git a/locale.c b/locale.c
index 881ebd9431..567a97aba0 100644
--- a/locale.c
+++ b/locale.c
@@ -499,23 +499,23 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
codeset = nl_langinfo(CODESET);
#endif
if (codeset)
- utf8locale = (ibcmp(codeset, "UTF-8", 5) == 0 ||
- ibcmp(codeset, "UTF8", 4) == 0);
+ utf8locale = (ibcmp(codeset, STR_WITH_LEN("UTF-8")) == 0 ||
+ ibcmp(codeset, STR_WITH_LEN("UTF8") ) == 0);
#if defined(USE_LOCALE)
else { /* nl_langinfo(CODESET) is supposed to correctly
* interpret the locale environment variables,
* but just in case it fails, let's do this manually. */
if (lang)
- utf8locale = (ibcmp(lang, "UTF-8", 5) == 0 ||
- ibcmp(lang, "UTF8", 4) == 0);
+ utf8locale = (ibcmp(lang, STR_WITH_LEN("UTF-8")) == 0 ||
+ ibcmp(lang, STR_WITH_LEN("UTF8") ) == 0);
#ifdef USE_LOCALE_CTYPE
if (curctype)
- utf8locale = (ibcmp(curctype, "UTF-8", 5) == 0 ||
- ibcmp(curctype, "UTF8", 4) == 0);
+ utf8locale = (ibcmp(curctype, STR_WITH_LEN("UTF-8")) == 0 ||
+ ibcmp(curctype, STR_WITH_LEN("UTF8") ) == 0);
#endif
if (lc_all)
- utf8locale = (ibcmp(lc_all, "UTF-8", 5) == 0 ||
- ibcmp(lc_all, "UTF8", 4) == 0);
+ utf8locale = (ibcmp(lc_all, STR_WITH_LEN("UTF-8")) == 0 ||
+ ibcmp(lc_all, STR_WITH_LEN("UTF8") ) == 0);
}
#endif /* USE_LOCALE */
if (utf8locale)
diff --git a/mg.c b/mg.c
index 3478b410dc..f13dd36f78 100644
--- a/mg.c
+++ b/mg.c
@@ -1444,7 +1444,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg)
* tell whether HINT_STRICT_REFS is in force or not.
*/
if (!strchr(s,':') && !strchr(s,'\''))
- sv_insert(sv, 0, 0, "main::", 6);
+ sv_insert(sv, 0, 0, STR_WITH_LEN("main::"));
if (i)
(void)rsignal(i, PL_csighandlerp);
else
diff --git a/perl.c b/perl.c
index cd8415ca09..1aff49da9f 100644
--- a/perl.c
+++ b/perl.c
@@ -1861,7 +1861,7 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
opts = space - pv;
sv_insert(opts_prog, opts, 0,
- "\\n ", 25);
+ STR_WITH_LEN("\\n "));
}
sv_catpvs(opts_prog,"\\n\",");
diff --git a/perlio.c b/perlio.c
index 95ac41d78a..6937b3609f 100644
--- a/perlio.c
+++ b/perlio.c
@@ -1414,20 +1414,20 @@ PerlIO_layer_from_ref(pTHX_ SV *sv)
* For any scalar type load the handler which is bundled with perl
*/
if (SvTYPE(sv) < SVt_PVAV)
- return PerlIO_find_layer(aTHX_ "scalar", 6, 1);
+ return PerlIO_find_layer(aTHX_ STR_WITH_LEN("scalar"), 1);
/*
* For other types allow if layer is known but don't try and load it
*/
switch (SvTYPE(sv)) {
case SVt_PVAV:
- return PerlIO_find_layer(aTHX_ "Array", 5, 0);
+ return PerlIO_find_layer(aTHX_ STR_WITH_LEN("Array"), 0);
case SVt_PVHV:
- return PerlIO_find_layer(aTHX_ "Hash", 4, 0);
+ return PerlIO_find_layer(aTHX_ STR_WITH_LEN("Hash"), 0);
case SVt_PVCV:
- return PerlIO_find_layer(aTHX_ "Code", 4, 0);
+ return PerlIO_find_layer(aTHX_ STR_WITH_LEN("Code"), 0);
case SVt_PVGV:
- return PerlIO_find_layer(aTHX_ "Glob", 4, 0);
+ return PerlIO_find_layer(aTHX_ STR_WITH_LEN("Glob"), 0);
}
return NULL;
}
diff --git a/sv.c b/sv.c
index bd433522da..6f296d71ce 100644
--- a/sv.c
+++ b/sv.c
@@ -11175,7 +11175,7 @@ S_varname(pTHX_ GV *gv, const char gvtype, PADOFFSET targ,
Perl_sv_catpvf(aTHX_ name, "[%"IVdf"]", (IV)aindex);
}
else if (subscript_type == FUV_SUBSCRIPT_WITHIN)
- sv_insert(name, 0, 0, "within ", 7);
+ sv_insert(name, 0, 0, STR_WITH_LEN("within "));
return name;
}