]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
ns: Move ns_detached_signatures_free() to networkstatus.c
authorDavid Goulet <dgoulet@torproject.org>
Wed, 25 Apr 2018 14:09:50 +0000 (10:09 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Fri, 27 Apr 2018 15:40:44 +0000 (11:40 -0400)
From dirvote.c to networkstatus.c where it makes more sense both in terms of
namespace and subsystem responsability.

This removes one less dependency on the dirauth module.

Signed-off-by: David Goulet <dgoulet@torproject.org>
src/or/dirauth/dirvote.c
src/or/dirauth/dirvote.h
src/or/networkstatus.c
src/or/networkstatus.h

index 5af6d841f8215f7522ea1a7a76b84d85a04df381..b28bcf5ce5a44847ef9332aea8ae84d2a6b40d62 100644 (file)
@@ -2703,25 +2703,6 @@ get_detached_signatures_from_pending_consensuses(pending_consensus_t *pending,
   return signatures;
 }
 
-/** Release all storage held in <b>s</b>. */
-void
-ns_detached_signatures_free_(ns_detached_signatures_t *s)
-{
-  if (!s)
-    return;
-  if (s->signatures) {
-    STRMAP_FOREACH(s->signatures, flavor, smartlist_t *, sigs) {
-      SMARTLIST_FOREACH(sigs, document_signature_t *, sig,
-                        document_signature_free(sig));
-      smartlist_free(sigs);
-    } STRMAP_FOREACH_END;
-    strmap_free(s->signatures, NULL);
-    strmap_free(s->digests, tor_free_);
-  }
-
-  tor_free(s);
-}
-
 /** Entry point: Take whatever voting actions are pending as of <b>now</b>. */
 void
 dirvote_act(const or_options_t *options, time_t now)
index 6f4c55243f5290ff530b8de8a5b0d445596df0f8..fcc7cecf26b8b48f79e1c5d027ac19367609e538 100644 (file)
@@ -115,11 +115,6 @@ dirvote_free_all(void)
 
 #endif /* HAVE_MODULE_DIRAUTH */
 
-/* Vote manipulation */
-void ns_detached_signatures_free_(ns_detached_signatures_t *s);
-#define ns_detached_signatures_free(s) \
-  FREE_AND_NULL(ns_detached_signatures_t, ns_detached_signatures_free_, (s))
-
 void dirvote_recalculate_timing(const or_options_t *options, time_t now);
 /* Invoked on timers and by outside triggers. */
 struct pending_vote_t * dirvote_add_vote(const char *vote_body,
index f78d9d672b3ee9871d6ce1058f78f13c8aaa457f..fa8d0bcf13072f25ae255e7bd3dfe806c39992a3 100644 (file)
@@ -2642,6 +2642,25 @@ networkstatus_check_required_protocols(const networkstatus_t *ns,
   return 0;
 }
 
+/** Release all storage held in <b>s</b>. */
+void
+ns_detached_signatures_free_(ns_detached_signatures_t *s)
+{
+  if (!s)
+    return;
+  if (s->signatures) {
+    STRMAP_FOREACH(s->signatures, flavor, smartlist_t *, sigs) {
+      SMARTLIST_FOREACH(sigs, document_signature_t *, sig,
+                        document_signature_free(sig));
+      smartlist_free(sigs);
+    } STRMAP_FOREACH_END;
+    strmap_free(s->signatures, NULL);
+    strmap_free(s->digests, tor_free_);
+  }
+
+  tor_free(s);
+}
+
 /** Free all storage held locally in this module. */
 void
 networkstatus_free_all(void)
index 04cf277d2f041719c9736a961906158fe612ba1c..bd782920508a72e6f945a9ef91c9874b20998626 100644 (file)
@@ -24,6 +24,9 @@ void routerstatus_free_(routerstatus_t *rs);
 void networkstatus_vote_free_(networkstatus_t *ns);
 #define networkstatus_vote_free(ns) \
   FREE_AND_NULL(networkstatus_t, networkstatus_vote_free_, (ns))
+void ns_detached_signatures_free_(ns_detached_signatures_t *s);
+#define ns_detached_signatures_free(s) \
+  FREE_AND_NULL(ns_detached_signatures_t, ns_detached_signatures_free_, (s))
 networkstatus_voter_info_t *networkstatus_get_voter_by_id(
                                        networkstatus_t *vote,
                                        const char *identity);