summaryrefslogtreecommitdiff
path: root/src/or/policies.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-05-16 22:16:13 +0000
committerNick Mathewson <nickm@torproject.org>2007-05-16 22:16:13 +0000
commitb4bd9f772ccc9e1570116a690c8bb99242b7a14a (patch)
tree6220947a672554da1a6c58436caa00fcbf8299b5 /src/or/policies.c
parent2988d797eb90657275be2de6e2b4cf0155a3a3e5 (diff)
downloadtor-b4bd9f772ccc9e1570116a690c8bb99242b7a14a.tar.gz
tor-b4bd9f772ccc9e1570116a690c8bb99242b7a14a.zip
r12771@catbus: nickm | 2007-05-16 18:12:32 -0400
Make -Wstrict-overflow=5 happy with GCC 4.2. It is kind of a pain, but it does agood job of letting us know where we can make our code better by simplifying dependent conditionals. svn:r10201
Diffstat (limited to 'src/or/policies.c')
-rw-r--r--src/or/policies.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/or/policies.c b/src/or/policies.c
index 3129ea35f7..f010553c13 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -508,29 +508,30 @@ exit_policy_remove_redundancies(addr_policy_t **dest)
previous = NULL;
while (ap) {
for (tmp=ap->next; tmp; tmp=tmp->next) {
- if (ap->policy_type != tmp->policy_type &&
- addr_policy_intersects(ap, tmp)) {
- tmp = NULL; /* so that we advance previous and ap */
- break;
- }
- if (ap->policy_type == tmp->policy_type &&
- addr_policy_covers(tmp, ap)) {
- log(LOG_DEBUG, LD_CONFIG, "Removing exit policy %s. It is already "
- "covered by %s.", ap->string, tmp->string);
- victim = ap;
- ap = ap->next;
-
- if (previous) {
- assert(previous->next == victim);
- previous->next = victim->next;
- } else {
- assert(*dest == victim);
- *dest = victim->next;
+ if (ap->policy_type != tmp->policy_type) {
+ if (addr_policy_intersects(ap, tmp)) {
+ tmp = NULL; /* so that we advance previous and ap */
+ break;
+ }
+ } else { /* policy_types are equal. */
+ if (addr_policy_covers(tmp, ap)) {
+ log(LOG_DEBUG, LD_CONFIG, "Removing exit policy %s. It is already "
+ "covered by %s.", ap->string, tmp->string);
+ victim = ap;
+ ap = ap->next;
+
+ if (previous) {
+ assert(previous->next == victim);
+ previous->next = victim->next;
+ } else {
+ assert(*dest == victim);
+ *dest = victim->next;
+ }
+
+ victim->next = NULL;
+ addr_policy_free(victim);
+ break;
}
-
- victim->next = NULL;
- addr_policy_free(victim);
- break;
}
}
if (!tmp) {