diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-01-01 20:26:27 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-01-01 20:26:27 +0000 |
commit | 770526c17acd97e1e85c98bfca98d1d4b69f53f8 (patch) | |
tree | cf9680519f3303b2264ba3ac94c1cd7b69c68706 /toke.c | |
parent | 9431620da4dbda8a9753e557013462a4cc50b03f (diff) | |
download | perl-770526c17acd97e1e85c98bfca98d1d4b69f53f8.tar.gz |
strEQ/strNE of 1 character strings seems better hand inlined,
because it generates smaller object code (as well as being
faster than a true function call)
p4raw-id: //depot/perl@23725
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -1,7 +1,7 @@ /* toke.c * * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - * 2000, 2001, 2002, 2003, 2004, by Larry Wall and others + * 2000, 2001, 2002, 2003, 2004, 2005, by Larry Wall and others * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -4253,7 +4253,7 @@ Perl_yylex(pTHX) char *proto = SvPV((SV*)cv, len); if (!len) TERM(FUNC0SUB); - if (strEQ(proto, "$")) + if (*proto == '$' && proto[1] == '\0') OPERATOR(UNIOPSUB); while (*proto == ';') proto++; @@ -5788,7 +5788,7 @@ Perl_keyword(pTHX_ register char *d, I32 len) else if (*d == 'l') { if (strEQ(d,"login")) return -KEY_getlogin; } - else if (strEQ(d,"c")) return -KEY_getc; + else if (*d == 'c' && d[1] == '\0') return -KEY_getc; break; } switch (len) { @@ -5935,12 +5935,16 @@ Perl_keyword(pTHX_ register char *d, I32 len) } break; case 'q': - if (len <= 2) { - if (strEQ(d,"q")) return KEY_q; - if (strEQ(d,"qr")) return KEY_qr; - if (strEQ(d,"qq")) return KEY_qq; - if (strEQ(d,"qw")) return KEY_qw; - if (strEQ(d,"qx")) return KEY_qx; + if (len == 1) { + return KEY_q; + } + else if (len == 2) { + switch (d[1]) { + case 'r': return KEY_qr; + case 'q': return KEY_qq; + case 'w': return KEY_qw; + case 'x': return KEY_qx; + }; } else if (strEQ(d,"quotemeta")) return -KEY_quotemeta; break; |