[tor-commits] [tor/master] sr: rename srv_dup() to sr_srv_dup()

nickm at torproject.org nickm at torproject.org
Tue Mar 12 15:03:57 UTC 2019


commit 593fde930fa52e0f4ed7aaf70c4ea9e4615d2a0e
Author: teor <teor at torproject.org>
Date:   Sat Mar 9 11:48:05 2019 +1000

    sr: rename srv_dup() to sr_srv_dup()
---
 src/or/shared_random.c        | 6 +++---
 src/or/shared_random.h        | 2 +-
 src/or/shared_random_state.c  | 2 +-
 src/test/test_shared_random.c | 8 ++++----
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/or/shared_random.c b/src/or/shared_random.c
index c3e640977..ddb6de1a5 100644
--- a/src/or/shared_random.c
+++ b/src/or/shared_random.c
@@ -113,7 +113,7 @@ static int32_t num_srv_agreements_from_vote;
 
 /* Return a heap allocated copy of the SRV <b>orig</b>. */
 sr_srv_t *
-srv_dup(const sr_srv_t *orig)
+sr_srv_dup(const sr_srv_t *orig)
 {
   sr_srv_t *duplicate = NULL;
 
@@ -1318,8 +1318,8 @@ sr_act_post_consensus(const networkstatus_t *consensus)
      * decided by the majority. */
     sr_state_unset_fresh_srv();
     /* Set the SR values from the given consensus. */
-    sr_state_set_previous_srv(srv_dup(consensus->sr_info.previous_srv));
-    sr_state_set_current_srv(srv_dup(consensus->sr_info.current_srv));
+    sr_state_set_previous_srv(sr_srv_dup(consensus->sr_info.previous_srv));
+    sr_state_set_current_srv(sr_srv_dup(consensus->sr_info.current_srv));
   }
 
   /* Prepare our state so that it's ready for the next voting period. */
diff --git a/src/or/shared_random.h b/src/or/shared_random.h
index 68a101979..c640470c1 100644
--- a/src/or/shared_random.h
+++ b/src/or/shared_random.h
@@ -129,7 +129,7 @@ const char *sr_commit_get_rsa_fpr(const sr_commit_t *commit)
 void sr_compute_srv(void);
 sr_commit_t *sr_generate_our_commit(time_t timestamp,
                                     const authority_cert_t *my_rsa_cert);
-sr_srv_t *srv_dup(const sr_srv_t *orig);
+sr_srv_t *sr_srv_dup(const sr_srv_t *orig);
 
 #ifdef SHARED_RANDOM_PRIVATE
 
diff --git a/src/or/shared_random_state.c b/src/or/shared_random_state.c
index e99817106..50c6d3dd7 100644
--- a/src/or/shared_random_state.c
+++ b/src/or/shared_random_state.c
@@ -1037,7 +1037,7 @@ state_rotate_srv(void)
   /* First delete previous SRV from the state. Object will be freed. */
   state_del_previous_srv();
   /* Set previous SRV to a copy of the current one. */
-  sr_state_set_previous_srv(srv_dup(sr_state_get_current_srv()));
+  sr_state_set_previous_srv(sr_srv_dup(sr_state_get_current_srv()));
   /* Free and NULL the current srv. */
   sr_state_set_current_srv(NULL);
 }
diff --git a/src/test/test_shared_random.c b/src/test/test_shared_random.c
index 5d3e574fa..93125e513 100644
--- a/src/test/test_shared_random.c
+++ b/src/test/test_shared_random.c
@@ -932,7 +932,7 @@ test_utils(void *arg)
 {
   (void) arg;
 
-  /* Testing srv_dup(). */
+  /* Testing sr_srv_dup(). */
   {
     sr_srv_t *srv = NULL, *dup_srv = NULL;
     const char *srv_value =
@@ -940,7 +940,7 @@ test_utils(void *arg)
     srv = tor_malloc_zero(sizeof(*srv));
     srv->num_reveals = 42;
     memcpy(srv->value, srv_value, sizeof(srv->value));
-    dup_srv = srv_dup(srv);
+    dup_srv = sr_srv_dup(srv);
     tt_assert(dup_srv);
     tt_u64_op(dup_srv->num_reveals, ==, srv->num_reveals);
     tt_mem_op(dup_srv->value, OP_EQ, srv->value, sizeof(srv->value));
@@ -1055,7 +1055,7 @@ test_state_transition(void *arg)
     test_sr_setup_srv(1);
     tt_assert(sr_state_get_current_srv());
     /* Take a copy of the data, because the state owns the pointer */
-    cur = srv_dup(sr_state_get_current_srv());
+    cur = sr_srv_dup(sr_state_get_current_srv());
     tt_assert(cur);
     /* After, the previous SRV should be the same as the old current SRV, and
      * the current SRV should be set to NULL */
@@ -1073,7 +1073,7 @@ test_state_transition(void *arg)
     test_sr_setup_srv(1);
     tt_assert(sr_state_get_current_srv());
     /* Take a copy of the data, because the state owns the pointer */
-    cur = srv_dup(sr_state_get_current_srv());
+    cur = sr_srv_dup(sr_state_get_current_srv());
     set_sr_phase(SR_PHASE_REVEAL);
     MOCK(get_my_v3_authority_cert, get_my_v3_authority_cert_m);
     new_protocol_run(now);





More information about the tor-commits mailing list