diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-11-30 20:09:09 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-11-30 20:09:09 +0000 |
commit | f061994487dadf6aa46f47636d79781ffd663366 (patch) | |
tree | 21a1f43cc7f37da552a04d468f6a468f36b5fe94 /src/or/policies.c | |
parent | 6fe70f4c69b80c12db5ad4f0cedac1a81ecd867a (diff) | |
download | tor-f061994487dadf6aa46f47636d79781ffd663366.tar.gz tor-f061994487dadf6aa46f47636d79781ffd663366.zip |
r16881@catbus: nickm | 2007-11-30 15:07:42 -0500
Do not keep a string representation of every single addr_policy_t lying around. This might save a few hundred K.
svn:r12617
Diffstat (limited to 'src/or/policies.c')
-rw-r--r-- | src/or/policies.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/or/policies.c b/src/or/policies.c index ba3a375a1b..4cb7047219 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -486,8 +486,11 @@ exit_policy_remove_redundancies(addr_policy_t **dest) tmp=ap; while (tmp) { if (tmp->next && addr_policy_covers(ap, tmp->next)) { + char p1[POLICY_BUF_LEN], p2[POLICY_BUF_LEN]; + policy_write_item(p1, sizeof(p1), tmp->next); + policy_write_item(p2, sizeof(p2), ap); log(LOG_DEBUG, LD_CONFIG, "Removing exit policy %s. It is made " - "redundant by %s.", tmp->next->string, ap->string); + "redundant by %s.", p1, p2); victim = tmp->next; tmp->next = victim->next; victim->next = NULL; @@ -516,8 +519,11 @@ exit_policy_remove_redundancies(addr_policy_t **dest) } } else { /* policy_types are equal. */ if (addr_policy_covers(tmp, ap)) { + char p1[POLICY_BUF_LEN], p2[POLICY_BUF_LEN]; + policy_write_item(p1, sizeof(p1), ap); + policy_write_item(p2, sizeof(p2), tmp); log(LOG_DEBUG, LD_CONFIG, "Removing exit policy %s. It is already " - "covered by %s.", ap->string, tmp->string); + "covered by %s.", ap, tmp); victim = ap; ap = ap->next; @@ -694,7 +700,6 @@ addr_policy_free(addr_policy_t *p) while (p) { e = p; p = p->next; - tor_free(e->string); tor_free(e); } } |