diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-07-07 11:52:13 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-07-07 11:52:13 -0400 |
commit | 64c8e8edda5a7f3525a1ab365c4bd72b19212322 (patch) | |
tree | f332a7c68897a39b81976bc9b0392e5e81848013 /src/or/routerlist.c | |
parent | 174cbff8cf855dc1bbf690694f539ba3f85a508c (diff) | |
download | tor-64c8e8edda5a7f3525a1ab365c4bd72b19212322.tar tor-64c8e8edda5a7f3525a1ab365c4bd72b19212322.tar.gz |
Kill redundant checks around routerset_contains_*()
All of the routerset_contains*() functions return 0 if their
routerset_t argument is NULL. Therefore, there's no point in
doing "if (ExcludeNodes && routerset_contains*(ExcludeNodes...))",
for example.
This patch fixes every instance of
if (X && routerstatus_contains*(X,...))
Note that there are other patterns that _aren't_ redundant. For
example, we *don't* want to change:
if (EntryNodes && !routerstatus_contains(EntryNodes,...))
Fixes #2797. No bug here; just needless code.
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r-- | src/or/routerlist.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 15f643cf7..00557a26e 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1132,7 +1132,7 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags) if ((type & MICRODESC_DIRINFO) && !is_trusted && !node->rs->version_supports_microdesc_cache) continue; - if (try_excluding && options->ExcludeNodes && + if (try_excluding && routerset_contains_routerstatus(options->ExcludeNodes, status, country)) { ++n_excluded; @@ -1237,7 +1237,7 @@ router_pick_trusteddirserver_impl(dirinfo_type_t type, int flags, continue; if (requireother && me && router_digest_is_me(d->digest)) continue; - if (try_excluding && options->ExcludeNodes && + if (try_excluding && routerset_contains_routerstatus(options->ExcludeNodes, &d->fake_status, -1)) { ++n_excluded; @@ -5567,7 +5567,8 @@ routerset_contains(const routerset_t *set, const tor_addr_t *addr, const char *nickname, const char *id_digest, country_t country) { - if (!set || !set->list) return 0; + if (!set || !set->list) + return 0; if (nickname && strmap_get_lc(set->names, nickname)) return 4; if (id_digest && digestmap_get(set->digests, id_digest)) |