Browse Source

Remove unused function declarations

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.
Sebastian Hahn 13 years ago
parent
commit
d5c83f2014

+ 3 - 0
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.

+ 0 - 1
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);

+ 0 - 2
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);
 

+ 0 - 1
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 {

+ 0 - 4
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);

+ 0 - 1
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);

+ 0 - 1
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
 

+ 0 - 1
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(

+ 0 - 1
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);

+ 0 - 8
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);

+ 0 - 5
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);
 

+ 0 - 70
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);