summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-02-01 23:03:11 +0000
committerNicholas Clark <nick@ccl4.org>2006-02-01 23:03:11 +0000
commit8ccce9aeff05ce7be92baddaafcf71c608c453d4 (patch)
tree7dd7de0ca2b096a4ad0ca4018f951f6f185902ba /gv.c
parentdfd48732bfcc9b134193e8c9ab5ae5983f431856 (diff)
downloadperl-8ccce9aeff05ce7be92baddaafcf71c608c453d4.tar.gz
doubleplusoops. Apart from the documented NUL termination assumption.
Now removed. p4raw-id: //depot/perl@27046
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/gv.c b/gv.c
index 5b75c0343c..8f023c1c02 100644
--- a/gv.c
+++ b/gv.c
@@ -825,31 +825,40 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
/* No stash in name, so see how we can default */
if (!stash) {
- if (isIDFIRST_lazy(name)) {
+ if (len && isIDFIRST_lazy(name)) {
bool global = FALSE;
- /* 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':
+ switch (len) {
+ case 1:
if (*name == '_')
global = TRUE;
break;
- case 'N':
- if (strEQ(name, "INC") || strEQ(name, "ENV"))
+ case 3:
+ if ((name[0] == 'I' && name[1] == 'N' && name[2] == 'C')
+ || (name[0] == 'E' && name[1] == 'N' && name[2] == 'V')
+ || (name[0] == 'S' && name[1] == 'I' && name[2] == 'G'))
global = TRUE;
break;
- case 'I':
- if (strEQ(name, "SIG"))
+ case 4:
+ if (name[0] == 'A' && name[1] == 'R' && name[2] == 'G'
+ && name[3] == 'V')
+ global = TRUE;
+ break;
+ case 5:
+ if (name[0] == 'S' && name[1] == 'T' && name[2] == 'D'
+ && name[3] == 'I' && name[4] == 'N')
global = TRUE;
break;
- case 'T':
- if (strEQ(name, "STDIN") || strEQ(name, "STDOUT") ||
- strEQ(name, "STDERR"))
+ case 6:
+ if ((name[0] == 'S' && name[1] == 'T' && name[2] == 'D')
+ &&((name[3] == 'O' && name[4] == 'U' && name[5] == 'T')
+ ||(name[3] == 'E' && name[4] == 'R' && name[5] == 'R')))
global = TRUE;
break;
- case 'R':
- if (strEQ(name, "ARGV") || strEQ(name, "ARGVOUT"))
+ case 7:
+ if (name[0] == 'A' && name[1] == 'R' && name[2] == 'G'
+ && name[3] == 'V' && name[4] == 'O' && name[5] == 'U'
+ && name[6] == 'T')
global = TRUE;
break;
}