summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2016-10-27 20:58:37 +0200
committerYves Orton <demerphq@gmail.com>2016-10-27 20:58:48 +0200
commit3092ee0cc2fd064f94e1ba8dc866b0ba8efc3cb8 (patch)
tree93dc5028f8f8f059db5c61293a8ade48998c1b68 /gv.c
parent055ae706a0637a77ba440aedf596d2ebac642051 (diff)
downloadperl-3092ee0cc2fd064f94e1ba8dc866b0ba8efc3cb8.tar.gz
optimise gv.c a bit (we could do better)
We save a few ops for package vars starting with 'E' by checking the second char as well. We could probably be much smarter with this switch, but we would have to generate it, which involves its own issues.
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gv.c b/gv.c
index 3b09b8a398..1cf0d8dd74 100644
--- a/gv.c
+++ b/gv.c
@@ -1856,10 +1856,12 @@ S_gv_magicalize(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len,
if (len) {
switch (*name) {
case 'E':
- if (memEQs(name, len, "EXPORT")
+ if (
+ len >= 6 && name[1] == 'X' &&
+ (memEQs(name, len, "EXPORT")
||memEQs(name, len, "EXPORT_OK")
||memEQs(name, len, "EXPORT_FAIL")
- ||memEQs(name, len, "EXPORT_TAGS")
+ ||memEQs(name, len, "EXPORT_TAGS"))
)
GvMULTI_on(gv);
break;
@@ -1921,10 +1923,12 @@ S_gv_magicalize(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len,
}
break;
case 'E':
- if (memEQs(name, len, "EXPORT")
+ if (
+ len >= 6 && name[1] == 'X' &&
+ (memEQs(name, len, "EXPORT")
||memEQs(name, len, "EXPORT_OK")
||memEQs(name, len, "EXPORT_FAIL")
- ||memEQs(name, len, "EXPORT_TAGS")
+ ||memEQs(name, len, "EXPORT_TAGS"))
)
GvMULTI_on(gv);
break;