summaryrefslogtreecommitdiff
path: root/src/or/cpuworker.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-12-08 10:21:12 -0500
committerNick Mathewson <nickm@torproject.org>2017-12-08 14:47:19 -0500
commitfa0d24286b1dac3959c338f6b76fc15dbe1559e5 (patch)
tree5ec27cfa8b633cc6729bbb7da9eface2541ccb28 /src/or/cpuworker.c
parent17dcce3fe11bfea9c7c46d2b9fd5baeb63ebe1e2 (diff)
downloadtor-fa0d24286b1dac3959c338f6b76fc15dbe1559e5.tar.gz
tor-fa0d24286b1dac3959c338f6b76fc15dbe1559e5.zip
Convert remaining function (mostly static) to new free style
Diffstat (limited to 'src/or/cpuworker.c')
-rw-r--r--src/or/cpuworker.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index d9371b3446..9bec04d790 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -48,14 +48,25 @@ worker_state_new(void *arg)
ws->onion_keys = server_onion_keys_new();
return ws;
}
+
+#define worker_state_free(ws) \
+ FREE_AND_NULL(worker_state_t, worker_state_free_, (ws))
+
static void
-worker_state_free(void *arg)
+worker_state_free_(worker_state_t *ws)
{
- worker_state_t *ws = arg;
+ if (!ws)
+ return;
server_onion_keys_free(ws->onion_keys);
tor_free(ws);
}
+static void
+worker_state_free_void(void *arg)
+{
+ worker_state_free_(arg);
+}
+
static replyqueue_t *replyqueue = NULL;
static threadpool_t *threadpool = NULL;
static struct event *reply_event = NULL;
@@ -102,7 +113,7 @@ cpu_init(void)
threadpool = threadpool_new(n_threads,
replyqueue,
worker_state_new,
- worker_state_free,
+ worker_state_free_void,
NULL);
}
/* Total voodoo. Can we make this more sensible? */
@@ -198,7 +209,7 @@ cpuworkers_rotate_keyinfo(void)
if (threadpool_queue_update(threadpool,
worker_state_new,
update_state_threadfn,
- worker_state_free,
+ worker_state_free_void,
NULL)) {
log_warn(LD_OR, "Failed to queue key update for worker threads.");
}