Opened 9 years ago

Closed 8 years ago

Last modified 7 years ago

#2797 closed defect (fixed)

Fix redundant checks around routerset_contains_XYZ()

Reported by: nickm Owned by:
Priority: Very Low Milestone: Tor: 0.2.3.x-final
Component: Core Tor/Tor Version:
Severity: Keywords: easy tor-client
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

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.

Child Tickets

Change History (4)

comment:1 Changed 8 years ago by nickm

Status: newneeds_review

Fixed in my bug2797 branch. please have a look to make sure I didn't screw up.

comment:2 Changed 8 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

No comments? Still looks ok to me; merged.

comment:3 Changed 7 years ago by nickm

Keywords: tor-client added

comment:4 Changed 7 years ago by nickm

Component: Tor ClientTor
Note: See TracTickets for help on using tickets.