projects
/
perl.git
/ commitdiff
free
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
3ac7ff8
)
remove most calls to strlen in S_force_ident
author
Daniel Dragan <bulk88@hotmail.com>
Wed, 14 Nov 2012 11:18:54 +0000 (06:18 -0500)
committer
Father Chrysostomos <sprout@cpan.org>
Wed, 14 Nov 2012 17:53:47 +0000 (09:53 -0800)
I saw strlen("\"") being called here, where the string came from
Perl_yylex. This commit provides a shortcut to not call strlen for a
1 character + null character string.
toke.c
patch
|
blob
|
blame
|
history
diff --git
a/toke.c
b/toke.c
index
cac14b9
..
a7c9ca5
100644
(file)
--- a/
toke.c
+++ b/
toke.c
@@
-2165,8
+2165,8
@@
S_force_ident(pTHX_ register const char *s, int kind)
PERL_ARGS_ASSERT_FORCE_IDENT;
- if (*s) {
- const STRLEN len = strlen(s);
+ if (s[0]) {
+ const STRLEN len = s[1] ? strlen(s) : 1; /* s = "\"" see yylex */
OP* const o = (OP*)newSVOP(OP_CONST, 0, newSVpvn_flags(s, len,
UTF ? SVf_UTF8 : 0));
start_force(PL_curforce);