From: Nicholas Clark Date: Fri, 31 Dec 2004 20:25:52 +0000 (+0000) Subject: Generate smaller object code by using a single switch statement X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=18ea00d7a2aca8b645ef7f054dd0117de27dfe0b;p=p5sagit%2Fp5-mst-13.2.git Generate smaller object code by using a single switch statement for determining which names are forced into main:: p4raw-id: //depot/perl@23718 --- diff --git a/gv.c b/gv.c index d2b885d..8fb7fba 100644 --- a/gv.c +++ b/gv.c @@ -720,24 +720,31 @@ Perl_gv_fetchpv(pTHX_ const char *nambeg, I32 add, I32 sv_type) if (isIDFIRST_lazy(name)) { bool global = FALSE; - if (isUPPER(*name)) { - if (*name == 'S' && ( - strEQ(name, "SIG") || - strEQ(name, "STDIN") || - strEQ(name, "STDOUT") || - strEQ(name, "STDERR"))) + /* name is always \0 terminated, and initial \0 wouldn't return + true from isIDFIRST_lazy, so we know that name[1] is defined */ + switch (name[1]) { + case '\0': + if (*name == '_') global = TRUE; - else if (*name == 'I' && strEQ(name, "INC")) + break; + case 'N': + if (strEQ(name, "INC") || strEQ(name, "ENV")) global = TRUE; - else if (*name == 'E' && strEQ(name, "ENV")) + break; + case 'I': + if (strEQ(name, "SIG")) global = TRUE; - else if (*name == 'A' && ( - strEQ(name, "ARGV") || - strEQ(name, "ARGVOUT"))) + break; + case 'T': + if (strEQ(name, "STDIN") || strEQ(name, "STDOUT") || + strEQ(name, "STDERR")) global = TRUE; + break; + case 'R': + if (strEQ(name, "ARGV") || strEQ(name, "ARGVOUT")) + global = TRUE; + break; } - else if (*name == '_' && !name[1]) - global = TRUE; if (global) stash = PL_defstash;