diff options
author | James E Keenan <jkeenan@cpan.org> | 2019-11-08 10:17:50 -0500 |
---|---|---|
committer | James E Keenan <jkeenan@cpan.org> | 2019-11-12 19:50:59 +0000 |
commit | 35bc1e35279523a59fee1761d7505ff5c04638c0 (patch) | |
tree | 2f4a788c40bd59c3c28fc2e2ef6fc646db67cb9a /mro_core.c | |
parent | ecfd8588da8b6d2b74d6476d4d1c9e40c7de8b8c (diff) | |
download | perl-35bc1e35279523a59fee1761d7505ff5c04638c0.tar.gz |
Fix: local variable hiding parameter of same name
LGTM provides static code analysis and recommendations for code quality
improvements. Their recent run over the Perl 5 core distribution
identified 12 instances where a local variable hid a parameter of
the same name in an outer scope. The LGTM rule governing this situation
can be found here:
Per: https://lgtm.com/rules/2156240606/
This patch renames local variables in approximately 8 of those instances
to comply with the LGTM recommendation. Suggestions for renamed
variables were made by Tony Cook.
For: https://github.com/Perl/perl5/pull/17281
Diffstat (limited to 'mro_core.c')
-rw-r--r-- | mro_core.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mro_core.c b/mro_core.c index ffcbba60a6..1fc7c7ca9d 100644 --- a/mro_core.c +++ b/mro_core.c @@ -859,15 +859,15 @@ Perl_mro_package_moved(pTHX_ HV * const stash, HV * const oldstash, mro_isa_changed_in on each. */ hv_iterinit(stashes); while((iter = hv_iternext(stashes))) { - HV * const stash = *(HV **)HEK_KEY(HeKEY_hek(iter)); - if(HvENAME(stash)) { + HV * const this_stash = *(HV **)HEK_KEY(HeKEY_hek(iter)); + if(HvENAME(this_stash)) { /* We have to restore the original meta->isa (that mro_gather_and_rename set aside for us) this way, in case one class in this list is a superclass of a another class that we have already encountered. In such a case, meta->isa will have been overwritten without old entries being deleted from PL_isarev. */ - struct mro_meta * const meta = HvMROMETA(stash); + struct mro_meta * const meta = HvMROMETA(this_stash); if(meta->isa != (HV *)HeVAL(iter)){ SvREFCNT_dec(meta->isa); meta->isa @@ -876,7 +876,7 @@ Perl_mro_package_moved(pTHX_ HV * const stash, HV * const oldstash, : (HV *)HeVAL(iter); HeVAL(iter) = NULL; /* We donated our reference count. */ } - mro_isa_changed_in(stash); + mro_isa_changed_in(this_stash); } } } |