summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorJames E Keenan <jkeenan@cpan.org>2019-11-08 10:17:50 -0500
committerJames E Keenan <jkeenan@cpan.org>2019-11-12 19:50:59 +0000
commit35bc1e35279523a59fee1761d7505ff5c04638c0 (patch)
tree2f4a788c40bd59c3c28fc2e2ef6fc646db67cb9a /hv.c
parentecfd8588da8b6d2b74d6476d4d1c9e40c7de8b8c (diff)
downloadperl-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 'hv.c')
-rw-r--r--hv.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/hv.c b/hv.c
index da0014c1ce..d34a79be77 100644
--- a/hv.c
+++ b/hv.c
@@ -2396,17 +2396,17 @@ Perl_hv_name_set(pTHX_ HV *hv, const char *name, U32 len, U32 flags)
if (iter->xhv_name_u.xhvnameu_name) {
if(iter->xhv_name_count) {
if(flags & HV_NAME_SETALL) {
- HEK ** const name = HvAUX(hv)->xhv_name_u.xhvnameu_names;
- HEK **hekp = name + (
+ HEK ** const this_name = HvAUX(hv)->xhv_name_u.xhvnameu_names;
+ HEK **hekp = this_name + (
iter->xhv_name_count < 0
? -iter->xhv_name_count
: iter->xhv_name_count
);
- while(hekp-- > name+1)
+ while(hekp-- > this_name+1)
unshare_hek_or_pvn(*hekp, 0, 0, 0);
/* The first elem may be null. */
- if(*name) unshare_hek_or_pvn(*name, 0, 0, 0);
- Safefree(name);
+ if(*this_name) unshare_hek_or_pvn(*this_name, 0, 0, 0);
+ Safefree(this_name);
iter = HvAUX(hv); /* may been realloced */
spot = &iter->xhv_name_u.xhvnameu_name;
iter->xhv_name_count = 0;