diff options
author | Nicholas Clark <nick@ccl4.org> | 2004-12-31 20:25:52 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2004-12-31 20:25:52 +0000 |
commit | 18ea00d7a2aca8b645ef7f054dd0117de27dfe0b (patch) | |
tree | b365733f82b92786fd49dc730a9d842b4c2c918e /gv.c | |
parent | 91f565cb7917a150a12e99a1cdc75421ac152718 (diff) | |
download | perl-18ea00d7a2aca8b645ef7f054dd0117de27dfe0b.tar.gz |
Generate smaller object code by using a single switch statement
for determining which names are forced into main::
p4raw-id: //depot/perl@23718
Diffstat (limited to 'gv.c')
-rw-r--r-- | gv.c | 33 |
1 files changed, 20 insertions, 13 deletions
@@ -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; |