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

[or-cvs] [tor/master] Remove unused function declarations



Author: Sebastian Hahn <sebastian@xxxxxxxxxxxxxx>
Date: Tue, 17 Aug 2010 23:27:02 +0200
Subject: Remove unused function declarations
Commit: d5c83f201441f2582dd074729d2ccdce90b1243e

Also remove some #if 0'd code from the unit tests for buffers. The
code was killed in e6794e58081af773073c266e23fe3ab2ebecdb7e (5 years
ago), and is now broken anyways.
---
 changes/headercleanup    |    3 ++
 src/or/buffers.h         |    1 -
 src/or/circuitbuild.h    |    2 -
 src/or/connection_edge.h |    1 -
 src/or/connection_or.h   |    4 --
 src/or/dirserv.h         |    1 -
 src/or/hibernate.h       |    1 -
 src/or/networkstatus.h   |    1 -
 src/or/rendservice.h     |    1 -
 src/or/rephist.h         |    8 -----
 src/or/routerparse.h     |    5 ---
 src/test/test.c          |   70 ----------------------------------------------
 12 files changed, 3 insertions(+), 95 deletions(-)
 create mode 100644 changes/headercleanup

diff --git a/changes/headercleanup b/changes/headercleanup
new file mode 100644
index 0000000..25a58fc
--- /dev/null
+++ b/changes/headercleanup
@@ -0,0 +1,3 @@
+  o Code simplifications and refactoring:
+    - Remove a bunch of unused function declarations as well as a block of
+      #if 0'd code from the unit tests. Closes bug 1824.
diff --git a/src/or/buffers.h b/src/or/buffers.h
index 42d92dd..8fd403d 100644
--- a/src/or/buffers.h
+++ b/src/or/buffers.h
@@ -23,7 +23,6 @@ void buf_dump_freelist_sizes(int severity);
 size_t buf_datalen(const buf_t *buf);
 size_t buf_allocation(const buf_t *buf);
 size_t buf_slack(const buf_t *buf);
-const char *_buf_peek_raw_buffer(const buf_t *buf);
 
 int read_to_buf(int s, size_t at_most, buf_t *buf, int *reached_eof,
                 int *socket_error);
diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h
index d6aaef2..f4cc2a9 100644
--- a/src/or/circuitbuild.h
+++ b/src/or/circuitbuild.h
@@ -107,8 +107,6 @@ void circuit_build_times_initial_alpha(circuit_build_times_t *cbt,
                                        double quantile, double time_ms);
 int circuit_build_times_update_alpha(circuit_build_times_t *cbt);
 double circuit_build_times_cdf(circuit_build_times_t *cbt, double x);
-void circuit_build_times_add_timeout_worker(circuit_build_times_t *cbt,
-                                       double quantile_cutoff);
 void circuitbuild_running_unit_tests(void);
 void circuit_build_times_reset(circuit_build_times_t *cbt);
 
diff --git a/src/or/connection_edge.h b/src/or/connection_edge.h
index c3d6098..d1bce48 100644
--- a/src/or/connection_edge.h
+++ b/src/or/connection_edge.h
@@ -82,7 +82,6 @@ void addressmap_get_mappings(smartlist_t *sl, time_t min_expires,
 int connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn,
                                                origin_circuit_t *circ,
                                                crypt_path_t *cpath);
-int hostname_is_noconnect_address(const char *address);
 
 /** Possible return values for parse_extended_hostname. */
 typedef enum hostname_type_t {
diff --git a/src/or/connection_or.h b/src/or/connection_or.h
index e4e99a6..7176302 100644
--- a/src/or/connection_or.h
+++ b/src/or/connection_or.h
@@ -46,10 +46,6 @@ void connection_or_write_var_cell_to_buf(const var_cell_t *cell,
 int connection_or_send_destroy(circid_t circ_id, or_connection_t *conn,
                                int reason);
 int connection_or_send_netinfo(or_connection_t *conn);
-int connection_or_send_cert(or_connection_t *conn);
-int connection_or_send_link_auth(or_connection_t *conn);
-int connection_or_compute_link_auth_hmac(or_connection_t *conn,
-                                         char *hmac_out);
 int is_or_protocol_version_known(uint16_t version);
 
 void cell_pack(packed_cell_t *dest, const cell_t *src);
diff --git a/src/or/dirserv.h b/src/or/dirserv.h
index fc5a554..5ebcb8b 100644
--- a/src/or/dirserv.h
+++ b/src/or/dirserv.h
@@ -55,7 +55,6 @@ enum was_router_added_t dirserv_add_multiple_descriptors(
 enum was_router_added_t dirserv_add_descriptor(routerinfo_t *ri,
                                                const char **msg,
                                                const char *source);
-void dirserv_free_descriptors(void);
 void dirserv_set_router_is_running(routerinfo_t *router, time_t now);
 int list_server_status_v1(smartlist_t *routers, char **router_status_out,
                           int for_controller);
diff --git a/src/or/hibernate.h b/src/or/hibernate.h
index 8192ac5..687fadb 100644
--- a/src/or/hibernate.h
+++ b/src/or/hibernate.h
@@ -24,7 +24,6 @@ void consider_hibernation(time_t now);
 int getinfo_helper_accounting(control_connection_t *conn,
                               const char *question, char **answer,
                               const char **errmsg);
-void accounting_set_bandwidth_usage_from_state(or_state_t *state);
 
 #endif
 
diff --git a/src/or/networkstatus.h b/src/or/networkstatus.h
index 4059dea..32b71a9 100644
--- a/src/or/networkstatus.h
+++ b/src/or/networkstatus.h
@@ -73,7 +73,6 @@ int networkstatus_set_current_consensus(const char *consensus,
                                         unsigned flags);
 void networkstatus_note_certs_arrived(void);
 void routers_update_all_from_networkstatus(time_t now, int dir_version);
-void routerstatus_list_update_from_consensus_networkstatus(time_t now);
 void routers_update_status_from_consensus_networkstatus(smartlist_t *routers,
                                                         int reset_failures);
 void signed_descs_update_status_from_consensus_networkstatus(
diff --git a/src/or/rendservice.h b/src/or/rendservice.h
index f979a39..1767714 100644
--- a/src/or/rendservice.h
+++ b/src/or/rendservice.h
@@ -15,7 +15,6 @@
 int num_rend_services(void);
 int rend_config_services(or_options_t *options, int validate_only);
 int rend_service_load_keys(void);
-void rend_services_init(void);
 void rend_services_introduce(void);
 void rend_consider_services_upload(time_t now);
 void rend_hsdir_routers_changed(void);
diff --git a/src/or/rephist.h b/src/or/rephist.h
index f655500..02ab2f1 100644
--- a/src/or/rephist.h
+++ b/src/or/rephist.h
@@ -57,14 +57,6 @@ void dump_pk_ops(int severity);
 
 void rep_hist_free_all(void);
 
-/* for hidden service usage statistics */
-void hs_usage_note_publish_total(const char *service_id, time_t now);
-void hs_usage_note_publish_novel(const char *service_id, time_t now);
-void hs_usage_note_fetch_total(const char *service_id, time_t now);
-void hs_usage_note_fetch_successful(const char *service_id, time_t now);
-void hs_usage_write_statistics_to_file(time_t now);
-void hs_usage_free_all(void);
-
 void rep_hist_exit_stats_init(time_t now);
 void rep_hist_reset_exit_stats(time_t now);
 void rep_hist_exit_stats_term(void);
diff --git a/src/or/routerparse.h b/src/or/routerparse.h
index 2313f68..e5ebf07 100644
--- a/src/or/routerparse.h
+++ b/src/or/routerparse.h
@@ -30,11 +30,6 @@ int router_parse_list_from_string(const char **s, const char *eos,
                                   int is_extrainfo,
                                   int allow_annotations,
                                   const char *prepend_annotations);
-int router_parse_routerlist_from_directory(const char *s,
-                                           routerlist_t **dest,
-                                           crypto_pk_env_t *pkey,
-                                           int check_version,
-                                           int write_to_cache);
 int router_parse_runningrouters(const char *str);
 int router_parse_directory(const char *str);
 
diff --git a/src/test/test.c b/src/test/test.c
index 4a34fd9..16ac1e4 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -345,76 +345,6 @@ test_buffers(void)
   buf_free(buf);
   buf = NULL;
 
-#if 0
-  {
-  int s;
-  int eof;
-  int i;
-  buf_t *buf2;
-  /****
-   * read_to_buf
-   ****/
-  s = open(get_fname("data"), O_WRONLY|O_CREAT|O_TRUNC, 0600);
-  write(s, str, 256);
-  close(s);
-
-  s = open(get_fname("data"), O_RDONLY, 0);
-  eof = 0;
-  errno = 0; /* XXXX */
-  i = read_to_buf(s, 10, buf, &eof);
-  printf("%s\n", strerror(errno));
-  test_eq(i, 10);
-  test_eq(eof, 0);
-  //test_eq(buf_capacity(buf), 4096);
-  test_eq(buf_datalen(buf), 10);
-
-  test_memeq(str, (char*)_buf_peek_raw_buffer(buf), 10);
-
-  /* Test reading 0 bytes. */
-  i = read_to_buf(s, 0, buf, &eof);
-  //test_eq(buf_capacity(buf), 512*1024);
-  test_eq(buf_datalen(buf), 10);
-  test_eq(eof, 0);
-  test_eq(i, 0);
-
-  /* Now test when buffer is filled exactly. */
-  buf2 = buf_new_with_capacity(6);
-  i = read_to_buf(s, 6, buf2, &eof);
-  //test_eq(buf_capacity(buf2), 6);
-  test_eq(buf_datalen(buf2), 6);
-  test_eq(eof, 0);
-  test_eq(i, 6);
-  test_memeq(str+10, (char*)_buf_peek_raw_buffer(buf2), 6);
-  buf_free(buf2);
-  buf2 = NULL;
-
-  /* Now test when buffer is filled with more data to read. */
-  buf2 = buf_new_with_capacity(32);
-  i = read_to_buf(s, 128, buf2, &eof);
-  //test_eq(buf_capacity(buf2), 128);
-  test_eq(buf_datalen(buf2), 32);
-  test_eq(eof, 0);
-  test_eq(i, 32);
-  buf_free(buf2);
-  buf2 = NULL;
-
-  /* Now read to eof. */
-  test_assert(buf_capacity(buf) > 256);
-  i = read_to_buf(s, 1024, buf, &eof);
-  test_eq(i, (256-32-10-6));
-  test_eq(buf_capacity(buf), MAX_BUF_SIZE);
-  test_eq(buf_datalen(buf), 256-6-32);
-  test_memeq(str, (char*)_buf_peek_raw_buffer(buf), 10); /* XXX Check rest. */
-  test_eq(eof, 0);
-
-  i = read_to_buf(s, 1024, buf, &eof);
-  test_eq(i, 0);
-  test_eq(buf_capacity(buf), MAX_BUF_SIZE);
-  test_eq(buf_datalen(buf), 256-6-32);
-  test_eq(eof, 1);
-  }
-#endif
-
  done:
   if (buf)
     buf_free(buf);
-- 
1.7.1