summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-04-16 16:08:04 +0000
committerNicholas Clark <nick@ccl4.org>2008-04-16 16:08:04 +0000
commitc94593d00233fc038590bd1033bbe8f67f02f70c (patch)
tree114ea196d5b8bf31b074a1144f03cdc553be8782 /gv.c
parent2f90724352f52b809834d375ef5bab2c674fdad4 (diff)
downloadperl-c94593d00233fc038590bd1033bbe8f67f02f70c.tar.gz
Avoid forwards and then backwards on the :: splitting logic in
Perl_gv_fetchmethod_autoload() p4raw-id: //depot/perl@33701
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gv.c b/gv.c
index 6bcf2bbc6c..ea0b34d084 100644
--- a/gv.c
+++ b/gv.c
@@ -618,6 +618,7 @@ Perl_gv_fetchmethod_autoload(pTHX_ HV *stash, const char *name, I32 autoload)
const char *nsplit = NULL;
GV* gv;
HV* ostash = stash;
+ const char * const origname = name;
PERL_ARGS_ASSERT_GV_FETCHMETHOD_AUTOLOAD;
@@ -625,16 +626,16 @@ Perl_gv_fetchmethod_autoload(pTHX_ HV *stash, const char *name, I32 autoload)
stash = NULL;
for (nend = name; *nend; nend++) {
- if (*nend == '\'')
+ if (*nend == '\'') {
nsplit = nend;
- else if (*nend == ':' && *(nend + 1) == ':')
- nsplit = ++nend;
+ name = nend + 1;
+ }
+ else if (*nend == ':' && *(nend + 1) == ':') {
+ nsplit = nend++;
+ name = nend + 1;
+ }
}
if (nsplit) {
- const char * const origname = name;
- name = nsplit + 1;
- if (*nsplit == ':')
- --nsplit;
if ((nsplit - origname) == 5 && memEQ(origname, "SUPER", 5)) {
/* ->SUPER::method should really be looked up in original stash */
SV * const tmpstr = sv_2mortal(Perl_newSVpvf(aTHX_ "%s::SUPER",