From: Nicholas Clark Date: Fri, 31 Dec 2004 22:46:25 +0000 (+0000) Subject: Doing the strnEQ char by char for 2 and 3 character strings X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e963d6d20fd5c6e0abfa3424e06c2c839218e5ba;p=p5sagit%2Fp5-mst-13.2.git Doing the strnEQ char by char for 2 and 3 character strings generates a smaller object file, and will be faster. p4raw-id: //depot/perl@23721 --- diff --git a/doio.c b/doio.c index 70b3535..5e568ed 100644 --- a/doio.c +++ b/doio.c @@ -1141,7 +1141,7 @@ Perl_mode_from_discipline(pTHX_ SV *discp) if (*s == ':') { switch (s[1]) { case 'r': - if (len > 3 && strnEQ(s+1, "raw", 3) + if (s[2] == 'a' && s[3] == 'w' && (!s[4] || s[4] == ':' || isSPACE(s[4]))) { mode = O_BINARY; @@ -1151,7 +1151,7 @@ Perl_mode_from_discipline(pTHX_ SV *discp) } /* FALL THROUGH */ case 'c': - if (len > 4 && strnEQ(s+1, "crlf", 4) + if (s[2] == 'r' && s[3] == 'l' && s[4] == 'f' && (!s[5] || s[5] == ':' || isSPACE(s[5]))) { mode = O_TEXT;