[or-cvs] r10929: Fix whitespaces and compilation in and around dirvote code. (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Wed Jul 25 22:56:51 UTC 2007


Author: nickm
Date: 2007-07-25 18:56:50 -0400 (Wed, 25 Jul 2007)
New Revision: 10929

Modified:
   tor/trunk/
   tor/trunk/src/or/directory.c
   tor/trunk/src/or/dirvote.c
   tor/trunk/src/or/or.h
Log:
 r13904 at catbus:  nickm | 2007-07-25 18:04:46 -0400
 Fix whitespaces and compilation in and around dirvote code.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r13904] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c	2007-07-25 22:56:47 UTC (rev 10928)
+++ tor/trunk/src/or/directory.c	2007-07-25 22:56:50 UTC (rev 10929)
@@ -35,7 +35,8 @@
                        const char *payload, size_t payload_len);
 static int directory_handle_command(dir_connection_t *conn);
 static int body_is_plausible(const char *body, size_t body_len, int purpose);
-static int purpose_needs_anonymity(uint8_t dir_purpose, uint8_t router_purpose);
+static int purpose_needs_anonymity(uint8_t dir_purpose,
+                                   uint8_t router_purpose);
 static char *http_get_header(const char *headers, const char *which);
 static void http_set_address_origin(const char *headers, connection_t *conn);
 static void connection_dir_download_networkstatus_failed(
@@ -2112,7 +2113,7 @@
   if (authdir_mode_v3(options) &&
       !strcmp(url,"/tor/post/vote")) { /* server descriptor post */
     const char *msg = "OK";
-    if (dirserv_add_vote(body, &msg)) {
+    if (dirvote_add_vote(body, &msg)) {
       write_http_status_line(conn, 200, "Vote stored");
     } else {
       tor_assert(msg);

Modified: tor/trunk/src/or/dirvote.c
===================================================================
--- tor/trunk/src/or/dirvote.c	2007-07-25 22:56:47 UTC (rev 10928)
+++ tor/trunk/src/or/dirvote.c	2007-07-25 22:56:50 UTC (rev 10929)
@@ -885,8 +885,7 @@
   pending_vote_t *pending_vote;
   const char *msg = "";
 
-  if ((pending_vote = dirvote_add_vote(tor_memdup(new_vote->dir,
-                                                  new_vote->dir_len), &msg))) {
+  if ((pending_vote = dirvote_add_vote(new_vote->dir, &msg))) {
     log_warn(LD_DIR, "Couldn't store my own vote! (I told myself, '%s'.)",
              msg);
     return;
@@ -916,7 +915,7 @@
 
 /** DOCDOC */
 pending_vote_t *
-dirvote_add_vote(char *vote_body, const char **msg_out)
+dirvote_add_vote(const char *vote_body, const char **msg_out)
 {
   networkstatus_vote_t *vote;
   networkstatus_voter_info_t *vi;
@@ -952,7 +951,8 @@
         if (v->vote->published < vote->published) {
           cached_dir_decref(v->vote_body);
           networkstatus_vote_free(v->vote);
-          v->vote_body = new_cached_dir(vote_body, vote->published);
+          v->vote_body = new_cached_dir(tor_strdup(vote_body),
+                                        vote->published);
           v->vote = vote;
           *msg_out = "ok";
           return v;
@@ -964,14 +964,14 @@
     });
 
   pending_vote = tor_malloc_zero(sizeof(pending_vote_t));
-  pending_vote->vote_body = new_cached_dir(vote_body, vote->published);
+  pending_vote->vote_body = new_cached_dir(tor_strdup(vote_body),
+                                           vote->published);
   pending_vote->vote = vote;
   smartlist_add(pending_vote_list, pending_vote);
 
   *msg_out = "ok";
   return pending_vote;
  err:
-  tor_free(vote_body);
   if (vote)
     networkstatus_vote_free(vote);
   if (!*msg_out)
@@ -1020,3 +1020,4 @@
     smartlist_free(votes);
   return -1;
 }
+

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2007-07-25 22:56:47 UTC (rev 10928)
+++ tor/trunk/src/or/or.h	2007-07-25 22:56:50 UTC (rev 10929)
@@ -2812,7 +2812,8 @@
 /* invoked on timers and by outside triggers. */
 void dirvote_perform_vote(void);
 void dirvote_clear_pending_votes(void);
-struct pending_vote_t * dirvote_add_vote(char *vote_body,const char **msg_out);
+struct pending_vote_t * dirvote_add_vote(const char *vote_body,
+                                         const char **msg_out);
 int dirvote_compute_consensus(void);
 
 #ifdef DIRVOTE_PRIVATE



More information about the tor-commits mailing list