summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-11-22 16:55:19 -0800
committerFather Chrysostomos <sprout@cpan.org>2010-11-22 16:55:19 -0800
commit99ee976292c47b41b12e66dc2a0fea4a98c9ab9f (patch)
treedaef6d1434445f39970670743bbe75db79e9c12c /gv.c
parent605aedcce76632b4ab6d032b928335097c11784a (diff)
downloadperl-99ee976292c47b41b12e66dc2a0fea4a98c9ab9f.tar.gz
Only call mro_package_moved on new substashes
Commit 298d65111 added this mro_package_moved call. It does not need to happen if the substash already exists, as it will already have had effective names assigned to it. It also may not be a good idea to set it in such cases, as it may make a recursive call to mro_get_linear_isa. I know this is utter paranoia, but someone may write a mro plugin that is not reëntrant. (The speed gain is worth it, though.)
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/gv.c b/gv.c
index 9a72996f93..b2cb5a4146 100644
--- a/gv.c
+++ b/gv.c
@@ -1072,16 +1072,18 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
return NULL;
if (!(stash = GvHV(gv)))
- stash = GvHV(gv) = newHV();
-
- if (!HvNAME_get(stash))
{
- hv_name_set(stash, nambeg, name_cursor - nambeg, 0);
- /* If the containing stash has multiple effective
- names, see that this one gets them, too. */
- if (HvAUX(GvSTASH(gv))->xhv_name_count)
- mro_package_moved(stash, NULL, gv, 1);
+ stash = GvHV(gv) = newHV();
+ if (!HvNAME_get(stash)) {
+ hv_name_set(stash, nambeg, name_cursor-nambeg, 0);
+ /* If the containing stash has multiple effective
+ names, see that this one gets them, too. */
+ if (HvAUX(GvSTASH(gv))->xhv_name_count)
+ mro_package_moved(stash, NULL, gv, 1);
+ }
}
+ else if (!HvNAME_get(stash))
+ hv_name_set(stash, nambeg, name_cursor - nambeg, 0);
}
if (*name_cursor == ':')