commit 3380dc9cc0a8cdaae0dbd3e8b7c11e4ccdab504d Author: Nick Mathewson nickm@torproject.org Date: Fri Jul 15 12:31:09 2011 -0400
Remove compare_addr_to_addr_policy
Nothing used it but the unit tests; everything else knows to use compare_tor_addr_to_addr_policy instead. --- src/or/policies.c | 12 ------------ src/or/policies.h | 2 -- src/test/test.c | 9 ++++++--- 3 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/src/or/policies.c b/src/or/policies.c index f80808d..5bd13b5 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -570,18 +570,6 @@ addr_policy_get_canonical_entry(addr_policy_t *e) return found->policy; }
-/** As compare_tor_addr_to_addr_policy, but instead of a tor_addr_t, takes - * in host order. */ -addr_policy_result_t -compare_addr_to_addr_policy(uint32_t addr, uint16_t port, - const smartlist_t *policy) -{ - /*XXXX deprecate this function when possible. */ - tor_addr_t a; - tor_addr_from_ipv4h(&a, addr); - return compare_tor_addr_to_addr_policy(&a, port, policy); -} - /** Helper for compare_tor_addr_to_addr_policy. Implements the case where * addr and port are both known. */ static addr_policy_result_t diff --git a/src/or/policies.h b/src/or/policies.h index 6f3624a..9859b00 100644 --- a/src/or/policies.h +++ b/src/or/policies.h @@ -37,8 +37,6 @@ addr_policy_t *addr_policy_get_canonical_entry(addr_policy_t *ent); int cmp_addr_policies(smartlist_t *a, smartlist_t *b); addr_policy_result_t compare_tor_addr_to_addr_policy(const tor_addr_t *addr, uint16_t port, const smartlist_t *policy); -addr_policy_result_t compare_addr_to_addr_policy(uint32_t addr, - uint16_t port, const smartlist_t *policy);
addr_policy_result_t compare_addr_to_node_policy(uint32_t addr, uint16_t port, const node_t *node); diff --git a/src/test/test.c b/src/test/test.c index 74ada0e..05f5922 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -998,12 +998,15 @@ test_policies(void)
smartlist_add(policy, p);
+ tor_addr_from_ipv4h(&tar, 0x01020304u); test_assert(ADDR_POLICY_ACCEPTED == - compare_addr_to_addr_policy(0x01020304u, 2, policy)); + compare_tor_addr_to_addr_policy(&tar, 2, policy)); + tor_addr_make_unspec(&tar); test_assert(ADDR_POLICY_PROBABLY_ACCEPTED == - compare_addr_to_addr_policy(0, 2, policy)); + compare_tor_addr_to_addr_policy(&tar, 2, policy)); + tor_addr_from_ipv4h(&tar, 0xc0a80102); test_assert(ADDR_POLICY_REJECTED == - compare_addr_to_addr_policy(0xc0a80102, 2, policy)); + compare_tor_addr_to_addr_policy(&tar, 2, policy));
test_assert(0 == policies_parse_exit_policy(NULL, &policy2, 1, NULL, 1)); test_assert(policy2);