[tor-bugs] #17824 [metrics-lib]: switch on string instead of many if-else with String comparison
Tor Bug Tracker & Wiki
blackhole at torproject.org
Sat Dec 12 15:05:02 UTC 2015
#17824: switch on string instead of many if-else with String comparison
-------------------------+--------------------------
Reporter: iwakeh | Owner: karsten
Type: enhancement | Status: accepted
Priority: Low | Milestone:
Component: metrics-lib | Version:
Severity: Minor | Resolution:
Keywords: | Actual Points:
Parent ID: #17822 | Points:
Sponsor: |
-------------------------+--------------------------
Comment (by iwakeh):
{{{startsWith()}} if-else-chains should also be changed to switch. The
startsWith() for parsing should not be necessary.
In DescriptorImpl it could be achieved by splitting the first line and use
the String after @type (if there is any) for the switch-stmt.
I also would suggest moving the version handling to the parser classes.
Some (like TorPerfResultImpl) verify the version anyway and could if need
arises handle several versions in future. Thus there is no need for
DescriptorImpl to check the versions.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/17824#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list