diff --git a/changes/headercleanup b/changes/headercleanup new file mode 100644 index 0000000000..25a58fcda8 --- /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 42d92dd89b..8fd403d954 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 d6aaef2fe9..f4cc2a904d 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 c3d6098c5a..d1bce48e8f 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 e4e99a6ea6..717630217c 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 fc5a5549c5..5ebcb8b2b0 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 8192ac5d8e..687fadb669 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 4059dead51..32b71a9ceb 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 f979a39417..1767714c60 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 f655500eb8..02ab2f1cbd 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 2313f68e02..e5ebf07615 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 4a34fd9ac4..16ac1e4a67 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);