This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Local variable 'o' hides a parameter of the same name
authorJames E Keenan <jkeenan@cpan.org>
Mon, 27 Jan 2020 20:22:54 +0000 (15:22 -0500)
committerJames E Keenan <jkeenan@cpan.org>
Wed, 29 Jan 2020 14:05:02 +0000 (09:05 -0500)
commita2aebd498cc4696ac846d931d2f6c89b781f4c56
tree54b9e1b401948de0f78d2aa916bb621837d145da
parentcc1242273b27d0d513b90c8edb5d396407eae6e9
Local variable 'o' hides a parameter of the same name

LGTM static code analysis identified declaration of 'o' in a scope where
a variable of the same name had already been declared in an enclosing
scope.

Simply renaming the variable within the inner scope did not work
(extensive segfaults).  Tony Cook identified problem:  In inner scope we
were using macro cLISTOPo, which implicitly modifies 'o'.  Since
cLISTOPo is nothing more than macro cLISTOPx() with 'o' provided as the
argument, we can resolve the problem by using cLISTOPx() with a better
named variable -- in this case, 'child'.

Reference:  https://lgtm.com/projects/g/Perl/perl5/snapshot/9b2028e54156e4dbcc7a57bbd72e1b00a2e0ce39/files/op.c?sort=name&dir=ASC&mode=heatmap#x9b0ebeab3d026530:1
op.c