[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #18902 [Core Tor/Tor]: Avoid variable shadowing in Tor
#18902: Avoid variable shadowing in Tor
---------------------------+------------------------------
Reporter: teor | Owner: cypherpunks
Type: defect | Status: assigned
Priority: Medium | Milestone: Tor: 0.2.???
Component: Core Tor/Tor | Version:
Severity: Normal | Resolution:
Keywords: easy refactor | Actual Points:
Parent ID: | Points:
Reviewer: | Sponsor:
---------------------------+------------------------------
Comment (by cypherpunks):
I have noticed several distinct cases of variable shadowing. Each case has
its own solution. To make reviewing easier i was thinking of splitting
these cases into separate commits.
The cases i have found so far are
* redeclaring variables for the same purpose (solution: use the existing
variables)
* declaring index variables outside for loops (this usually conflicts with
subsequent smartlist iterations that use the same index variable names)
(solution: declare index variables inside for loops)
* using local variable names that match static global variable names
(solution: append `_local` to the local variable names unless renaming
them to something more descriptive is appropriate)
I'm unsure how to generate a script that can detect variable shadowing and
fix the issues according to the proposed solutions so I'm doing it
manually for now.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18902#comment:5>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs