[tor-bugs] #2797 [Tor Client]: Fix redundant checks around routerset_contains_XYZ()
Tor Bug Tracker & Wiki
torproject-admin at torproject.org
Fri Mar 25 18:19:54 UTC 2011
#2797: Fix redundant checks around routerset_contains_XYZ()
------------------------+---------------------------------------------------
Reporter: nickm | Owner:
Type: defect | Status: new
Priority: trivial | Milestone: Tor: 0.2.3.x-final
Component: Tor Client | Version:
Keywords: easy | Parent:
Points: | Actualpoints:
------------------------+---------------------------------------------------
The routerset_contains_foo() functions currently accept "NULL" in place of
a routerset argument, with "NULL" denoting an empty routerset. (IOW,
routerset_contains_node(NULL, node) always returns false.)
But our code acts like we don't know this: in lots of places, we say stuff
like
{{{
if (set && routerset_contains_node(set, node)) {
}
}}}
which is redundant and silly. We can remove the "set &&" with no ill
effect.
Note that this shouldn't be confused with
{{{
if (!set || routerset_contains_node(set, node)) {
}
}}}
which is how we say, "in this case, NULL means 'all nodes are included.'"
I'm tagging this as a ticket for 0.2.3.x. We should only do this once
0.2.2 has settled down a little more though, since the merges are likely
to be conflicty given the router->node transition.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/2797>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list