summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-10-16 09:38:48 +0000
committerNicholas Clark <nick@ccl4.org>2007-10-16 09:38:48 +0000
commitf85893a12feb8ca0f4e9b625542f3ff2920ac00c (patch)
treed3af2fe4618587ef3281ede8a895ebcfc44bdf48 /perl.c
parenteb0d8d164d5cb9454deba917ad0f286e2bdca2ab (diff)
downloadperl-f85893a12feb8ca0f4e9b625542f3ff2920ac00c.tar.gz
Moving a strlen() in Perl_moreswitches() saves a strlen() in sv_catpv()
Brought to you by the Campaign for the Elimination of strlen(). p4raw-id: //depot/perl@32112
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/perl.c b/perl.c
index bb35671e3a..d62b3bdbf5 100644
--- a/perl.c
+++ b/perl.c
@@ -3050,20 +3050,21 @@ Perl_moreswitches(pTHX_ const char *s)
/* The following permits -d:Mod to accepts arguments following an =
in the fashion that -MSome::Mod does. */
if (*s == ':' || *s == '=') {
- const char *start;
+ const char *start = ++s;
+ const char *const end = s + strlen(s);
SV * const sv = newSVpvs("use Devel::");
- start = ++s;
+
/* We now allow -d:Module=Foo,Bar */
while(isALNUM(*s) || *s==':') ++s;
if (*s != '=')
- sv_catpv(sv, start);
+ sv_catpvn(sv, start, end - start);
else {
sv_catpvn(sv, start, s-start);
/* Don't use NUL as q// delimiter here, this string goes in the
* environment. */
Perl_sv_catpvf(aTHX_ sv, " split(/,/,q{%s});", ++s);
}
- s += strlen(s);
+ s = end;
my_setenv("PERL5DB", SvPV_nolen_const(sv));
SvREFCNT_dec(sv);
}