aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-12-12 01:30:59 -0500
committerNick Mathewson <nickm@torproject.org>2009-12-12 01:31:35 -0500
commit79f72d0ef6cc3ce7cc92146ed0f0bdc7a4acad1a (patch)
treecd32d70ad0d3db8722b5e178fe7a6d72adb40a5c
parent3807db001d71c51e53c1897ae067671f5b771f2f (diff)
downloadtor-79f72d0ef6cc3ce7cc92146ed0f0bdc7a4acad1a.tar
tor-79f72d0ef6cc3ce7cc92146ed0f0bdc7a4acad1a.tar.gz
Make rend_cache_entry_free() typecheck when possible.
-rw-r--r--src/or/rendcommon.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index a68ee0c50..92a9af78c 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -778,14 +778,21 @@ rend_cache_init(void)
/** Helper: free storage held by a single service descriptor cache entry. */
static void
-_rend_cache_entry_free(void *p)
+rend_cache_entry_free(rend_cache_entry_t *e)
{
- rend_cache_entry_t *e = p;
+ if (!e)
+ return;
rend_service_descriptor_free(e->parsed);
tor_free(e->desc);
tor_free(e);
}
+static void
+_rend_cache_entry_free(void *p)
+{
+ rend_cache_entry_free(p);
+}
+
/** Free all storage held by the service descriptor cache. */
void
rend_cache_free_all(void)
@@ -814,7 +821,7 @@ rend_cache_clean(void)
ent = (rend_cache_entry_t*)val;
if (ent->parsed->timestamp < cutoff) {
iter = strmap_iter_next_rmv(rend_cache, iter);
- _rend_cache_entry_free(ent);
+ rend_cache_entry_free(ent);
} else {
iter = strmap_iter_next(rend_cache, iter);
}
@@ -842,7 +849,7 @@ rend_cache_clean_v2_descs_as_dir(void)
log_info(LD_REND, "Removing descriptor with ID '%s' from cache",
safe_str(key_base32));
iter = digestmap_iter_next_rmv(rend_cache_v2_dir, iter);
- _rend_cache_entry_free(ent);
+ rend_cache_entry_free(ent);
} else {
iter = digestmap_iter_next(rend_cache_v2_dir, iter);
}