[tor-commits] [tor/master] Simplify transport_is_needed.
nickm at torproject.org
nickm at torproject.org
Tue Oct 29 05:31:06 UTC 2013
commit e6e6c245c8ef3e5f854d82a67550456857f57ed4
Author: David Fifield <david at bamsoftware.com>
Date: Sat Oct 26 14:34:48 2013 -0700
Simplify transport_is_needed.
By Roger at
https://trac.torproject.org/projects/tor/ticket/5018#comment:11.
---
src/or/entrynodes.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index beb855d..ca3ef53 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -1766,22 +1766,16 @@ bridge_resolve_conflicts(const tor_addr_t *addr, uint16_t port,
int
transport_is_needed(const char *transport_name)
{
- int retval;
- smartlist_t *needed_transports = NULL;
-
if (!bridge_list)
return 0;
- needed_transports = smartlist_new();
-
SMARTLIST_FOREACH_BEGIN(bridge_list, const bridge_info_t *, bridge) {
- if (bridge->transport_name)
- smartlist_add(needed_transports, bridge->transport_name);
+ if (bridge->transport_name &&
+ !strcmp(bridge->transport_name, transport_name))
+ return 1;
} SMARTLIST_FOREACH_END(bridge);
- retval = smartlist_string_isin(needed_transports, transport_name);
- smartlist_free(needed_transports);
- return retval;
+ return 0;
}
/** Remember a new bridge at <b>addr</b>:<b>port</b>. If <b>digest</b>
More information about the tor-commits
mailing list