diff options
author | Father Chrysostomos <sprout@cpan.org> | 2010-11-27 07:11:20 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-11-27 07:41:47 -0800 |
commit | 06f3ce8671cf9695edecc29f8df95fec541d24ed (patch) | |
tree | 8849ddf75f7e506c4d5ac353a1159cd07ecf817f | |
parent | 479c6c1fd338d42abb75c5a3b20536d596088a32 (diff) | |
download | perl-06f3ce8671cf9695edecc29f8df95fec541d24ed.tar.gz |
Avoid a redundant check in mro.c
This code is never reached if oldstash is a hash without an HvENAME.
So instead of checking oldstash in the ?:, then hvename in the if(),
we can do one check.
If oldstash is no longer in the symbol table, then this code is never
reached, because of the if(!fetched_isarev) guard.
-rw-r--r-- | mro.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -984,13 +984,17 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes, if(!fetched_isarev) { /* If oldstash is not null, then we can use its HvENAME to look up the isarev hash, since all its subclasses will be listed there. + It will always have an HvENAME. It the HvENAME was removed + above, then fetch_isarev will be true, and this code will not be + reached. - If oldstash is null or is no longer in the symbol table, then - this is an empty spot with no stash in it, so subclasses could - be listed in isarev hashes belonging to any of the names, so we - have to check all of them. */ - char *hvename = oldstash ? HvENAME(oldstash) : NULL; - if (hvename) { + If oldstash is null, then this is an empty spot with no stash in + it, so subclasses could be listed in isarev hashes belonging to + any of the names, so we have to check all of them. + */ + if (oldstash) { + /* Extra variable to avoid a compiler warning */ + char * const hvename = HvENAME(oldstash); fetched_isarev = TRUE; svp = hv_fetch(PL_isarev, hvename, HvENAMELEN_get(oldstash), 0); if (svp) isarev = MUTABLE_HV(*svp); |