diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-02-01 23:03:11 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-02-01 23:03:11 +0000 |
commit | 8ccce9aeff05ce7be92baddaafcf71c608c453d4 (patch) | |
tree | 7dd7de0ca2b096a4ad0ca4018f951f6f185902ba /gv.c | |
parent | dfd48732bfcc9b134193e8c9ab5ae5983f431856 (diff) | |
download | perl-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.c | 37 |
1 files changed, 23 insertions, 14 deletions
@@ -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; } |