[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] ns: Move ns_detached_signatures_free() to networkstatus.c



commit d7e4706f2293cb199d3246197b2d911188de0e45
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
Date:   Wed Apr 25 10:09:50 2018 -0400

    ns: Move ns_detached_signatures_free() to networkstatus.c
    
    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@xxxxxxxxxxxxxx>
---
 src/or/dirauth/dirvote.c | 19 -------------------
 src/or/dirauth/dirvote.h |  5 -----
 src/or/networkstatus.c   | 19 +++++++++++++++++++
 src/or/networkstatus.h   |  3 +++
 4 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index 5af6d841f..b28bcf5ce 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -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)
diff --git a/src/or/dirauth/dirvote.h b/src/or/dirauth/dirvote.h
index 6f4c55243..fcc7cecf2 100644
--- a/src/or/dirauth/dirvote.h
+++ b/src/or/dirauth/dirvote.h
@@ -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,
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index f78d9d672..fa8d0bcf1 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -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)
diff --git a/src/or/networkstatus.h b/src/or/networkstatus.h
index 04cf277d2..bd7829205 100644
--- a/src/or/networkstatus.h
+++ b/src/or/networkstatus.h
@@ -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);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits