diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-12-07 10:44:04 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-12-08 14:47:19 -0500 |
commit | 285632a61b4e4aeec07b26004396473e0d8f4a43 (patch) | |
tree | ec6b0363f3072ba5e5c13ac1fb7cb2fb3c44db50 /src/or | |
parent | 95531ddfbfb6cb30760523d91fd4dfc966d2f6a5 (diff) | |
download | tor-285632a61b4e4aeec07b26004396473e0d8f4a43.tar.gz tor-285632a61b4e4aeec07b26004396473e0d8f4a43.zip |
Replace all FREE_AND_NULL* uses to take a type and a free function.
This commit was made mechanically by this perl script:
\#!/usr/bin/perl -w -i -p
next if /^#define FREE_AND_NULL/;
s/\bFREE_AND_NULL\((\w+),/FREE_AND_NULL\(${1}_t, ${1}_free_,/;
s/\bFREE_AND_NULL_UNMATCHED\(/FREE_AND_NULL\(/;
Diffstat (limited to 'src/or')
36 files changed, 66 insertions, 66 deletions
diff --git a/src/or/channel.h b/src/or/channel.h index 0ee99dcaff..1ff226d374 100644 --- a/src/or/channel.h +++ b/src/or/channel.h @@ -517,9 +517,9 @@ void channel_listener_closed(channel_listener_t *chan_l); /* Free a channel */ void channel_free_(channel_t *chan); -#define channel_free(chan) FREE_AND_NULL(channel, (chan)) +#define channel_free(chan) FREE_AND_NULL(channel_t, channel_free_, (chan)) void channel_listener_free_(channel_listener_t *chan_l); -#define channel_listener_free(chan_l) FREE_AND_NULL(channel_listener, (chan_l)) +#define channel_listener_free(chan_l) FREE_AND_NULL(channel_listener_t, channel_listener_free_, (chan_l)) /* State/metadata setters */ @@ -722,7 +722,7 @@ int packed_cell_is_destroy(channel_t *chan, /* Declare the handle helpers */ HANDLE_DECL(channel, channel_s,) #define channel_handle_free(h) \ - FREE_AND_NULL(channel_handle, (h)) + FREE_AND_NULL(channel_handle_t, channel_handle_free_, (h)) #endif /* !defined(TOR_CHANNEL_H) */ diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h index 6c3c91f83b..68c6d9ea7f 100644 --- a/src/or/circuitbuild.h +++ b/src/or/circuitbuild.h @@ -59,7 +59,7 @@ extend_info_t *extend_info_new(const char *nickname, extend_info_t *extend_info_from_node(const node_t *r, int for_direct_connect); extend_info_t *extend_info_dup(extend_info_t *info); void extend_info_free_(extend_info_t *info); -#define extend_info_free(info) FREE_AND_NULL(extend_info, (info)) +#define extend_info_free(info) FREE_AND_NULL(extend_info_t, extend_info_free_, (info)) int extend_info_addr_is_allowed(const tor_addr_t *addr); int extend_info_supports_tap(const extend_info_t* ei); int extend_info_supports_ntor(const extend_info_t* ei); diff --git a/src/or/circuitlist.h b/src/or/circuitlist.h index ffa250b2c5..bf3393a941 100644 --- a/src/or/circuitlist.h +++ b/src/or/circuitlist.h @@ -82,7 +82,7 @@ smartlist_t *circuit_find_circuits_to_upgrade_from_guard_wait(void); #ifdef CIRCUITLIST_PRIVATE STATIC void circuit_free_(circuit_t *circ); -#define circuit_free(circ) FREE_AND_NULL(circuit, (circ)) +#define circuit_free(circ) FREE_AND_NULL(circuit_t, circuit_free_, (circ)) STATIC size_t n_cells_in_circ_queues(const circuit_t *c); STATIC uint32_t circuit_max_queued_data_age(const circuit_t *c, uint32_t now); STATIC uint32_t circuit_max_queued_cell_age(const circuit_t *c, uint32_t now); diff --git a/src/or/circuitmux.h b/src/or/circuitmux.h index e7f345f678..689decee85 100644 --- a/src/or/circuitmux.h +++ b/src/or/circuitmux.h @@ -105,7 +105,7 @@ circuitmux_t * circuitmux_alloc(void); void circuitmux_detach_all_circuits(circuitmux_t *cmux, smartlist_t *detached_out); void circuitmux_free_(circuitmux_t *cmux); -#define circuitmux_free(cmux) FREE_AND_NULL(circuitmux, (cmux)) +#define circuitmux_free(cmux) FREE_AND_NULL(circuitmux_t, circuitmux_free_, (cmux)) /* Policy control */ void circuitmux_clear_policy(circuitmux_t *cmux); diff --git a/src/or/config.h b/src/or/config.h index cc8003fb35..c591a8e544 100644 --- a/src/or/config.h +++ b/src/or/config.h @@ -153,7 +153,7 @@ typedef struct bridge_line_t { } bridge_line_t; void bridge_line_free_(bridge_line_t *bridge_line); -#define bridge_line_free(line) FREE_AND_NULL(bridge_line, (line)) +#define bridge_line_free(line) FREE_AND_NULL(bridge_line_t, bridge_line_free_, (line)) bridge_line_t *parse_bridge_line(const char *line); smartlist_t *get_options_from_transport_options_line(const char *line, const char *transport); diff --git a/src/or/connection.h b/src/or/connection.h index d1811c79bf..9ba1606d66 100644 --- a/src/or/connection.h +++ b/src/or/connection.h @@ -30,7 +30,7 @@ int connection_init_accepted_conn(connection_t *conn, const listener_connection_t *listener); void connection_link_connections(connection_t *conn_a, connection_t *conn_b); MOCK_DECL(void,connection_free_,(connection_t *conn)); -#define connection_free(conn) FREE_AND_NULL(connection, (conn)) +#define connection_free(conn) FREE_AND_NULL(connection_t, connection_free_, (conn)) void connection_free_all(void); void connection_about_to_close_connection(connection_t *conn); void connection_close_immediate(connection_t *conn); diff --git a/src/or/connection_or.h b/src/or/connection_or.h index 107af491eb..986b8cec45 100644 --- a/src/or/connection_or.h +++ b/src/or/connection_or.h @@ -70,7 +70,7 @@ time_t connection_or_client_used(or_connection_t *conn); MOCK_DECL(int, connection_or_get_num_circuits, (or_connection_t *conn)); void or_handshake_state_free_(or_handshake_state_t *state); #define or_handshake_state_free(state) \ - FREE_AND_NULL(or_handshake_state, (state)) + FREE_AND_NULL(or_handshake_state_t, or_handshake_state_free_, (state)) void or_handshake_state_record_cell(or_connection_t *conn, or_handshake_state_t *state, const cell_t *cell, @@ -108,7 +108,7 @@ int var_cell_pack_header(const var_cell_t *cell, char *hdr_out, var_cell_t *var_cell_new(uint16_t payload_len); var_cell_t *var_cell_copy(const var_cell_t *src); void var_cell_free_(var_cell_t *cell); -#define var_cell_free(cell) FREE_AND_NULL(var_cell, (cell)) +#define var_cell_free(cell) FREE_AND_NULL(var_cell_t, var_cell_free_, (cell)) /* DOCDOC */ #define MIN_LINK_PROTO_FOR_WIDE_CIRC_IDS 4 diff --git a/src/or/conscache.h b/src/or/conscache.h index 0c02f6ebc2..501917bd02 100644 --- a/src/or/conscache.h +++ b/src/or/conscache.h @@ -11,11 +11,11 @@ typedef struct consensus_cache_t consensus_cache_t; HANDLE_DECL(consensus_cache_entry, consensus_cache_entry_t, ) #define consensus_cache_entry_handle_free(h) \ - FREE_AND_NULL(consensus_cache_entry_handle, (h)) + FREE_AND_NULL(consensus_cache_entry_handle_t, consensus_cache_entry_handle_free_, (h)) consensus_cache_t *consensus_cache_open(const char *subdir, int max_entries); void consensus_cache_free_(consensus_cache_t *cache); -#define consensus_cache_free(cache) FREE_AND_NULL(consensus_cache, (cache)) +#define consensus_cache_free(cache) FREE_AND_NULL(consensus_cache_t, consensus_cache_free_, (cache)) struct sandbox_cfg_elem; int consensus_cache_may_overallocate(consensus_cache_t *cache); int consensus_cache_register_with_sandbox(consensus_cache_t *cache, diff --git a/src/or/dircollate.h b/src/or/dircollate.h index ab44c83b00..f165bdfaf8 100644 --- a/src/or/dircollate.h +++ b/src/or/dircollate.h @@ -19,7 +19,7 @@ typedef struct dircollator_s dircollator_t; dircollator_t *dircollator_new(int n_votes, int n_authorities); void dircollator_free_(dircollator_t *obj); -#define dircollator_free(c) FREE_AND_NULL(dircollator, (c)) +#define dircollator_free(c) FREE_AND_NULL(dircollator_t, dircollator_free_, (c)) void dircollator_add_vote(dircollator_t *dc, networkstatus_t *v); void dircollator_collate(dircollator_t *dc, int consensus_method); diff --git a/src/or/directory.h b/src/or/directory.h index 89913038e5..08ed5024d9 100644 --- a/src/or/directory.h +++ b/src/or/directory.h @@ -52,7 +52,7 @@ int directory_must_use_begindir(const or_options_t *options); typedef struct directory_request_t directory_request_t; directory_request_t *directory_request_new(uint8_t dir_purpose); void directory_request_free_(directory_request_t *req); -#define directory_request_free(req) FREE_AND_NULL(directory_request, (req)) +#define directory_request_free(req) FREE_AND_NULL(directory_request_t, directory_request_free_, (req)) void directory_request_set_or_addr_port(directory_request_t *req, const tor_addr_port_t *p); void directory_request_set_dir_addr_port(directory_request_t *req, diff --git a/src/or/dirserv.h b/src/or/dirserv.h index 037294bdb1..7c5006b182 100644 --- a/src/or/dirserv.h +++ b/src/or/dirserv.h @@ -196,7 +196,7 @@ spooled_resource_t *spooled_resource_new(dir_spool_source_t source, spooled_resource_t *spooled_resource_new_from_cache_entry( struct consensus_cache_entry_t *entry); void spooled_resource_free_(spooled_resource_t *spooled); -#define spooled_resource_free(sp) FREE_AND_NULL(spooled_resource, (sp)) +#define spooled_resource_free(sp) FREE_AND_NULL(spooled_resource_t, spooled_resource_free_, (sp)) void dirserv_spool_remove_missing_and_guess_size(dir_connection_t *conn, time_t cutoff, int compression, diff --git a/src/or/dirvote.h b/src/or/dirvote.h index 29fb07273d..6a02ea3e36 100644 --- a/src/or/dirvote.h +++ b/src/or/dirvote.h @@ -138,7 +138,7 @@ int networkstatus_add_detached_signatures(networkstatus_t *target, char *networkstatus_get_detached_signatures(smartlist_t *consensuses); void ns_detached_signatures_free_(ns_detached_signatures_t *s); #define ns_detached_signatures_free(s) \ - FREE_AND_NULL(ns_detached_signatures, (s)) + FREE_AND_NULL(ns_detached_signatures_t, ns_detached_signatures_free_, (s)) /* cert manipulation */ authority_cert_t *authority_cert_dup(authority_cert_t *cert); diff --git a/src/or/entrynodes.h b/src/or/entrynodes.h index 5fd4c970db..32fcfeadfb 100644 --- a/src/or/entrynodes.h +++ b/src/or/entrynodes.h @@ -477,7 +477,7 @@ STATIC double get_extreme_restriction_threshold(void); HANDLE_DECL(entry_guard, entry_guard_t, STATIC) #define entry_guard_handle_free(h) \ - FREE_AND_NULL(entry_guard_handle, (h)) + FREE_AND_NULL(entry_guard_handle_t, entry_guard_handle_free_, (h)) STATIC guard_selection_type_t guard_selection_infer_type( guard_selection_type_t type_in, @@ -487,7 +487,7 @@ STATIC guard_selection_t *guard_selection_new(const char *name, STATIC guard_selection_t *get_guard_selection_by_name( const char *name, guard_selection_type_t type, int create_if_absent); STATIC void guard_selection_free_(guard_selection_t *gs); -#define guard_selection_free(gs) FREE_AND_NULL(guard_selection, (gs)) +#define guard_selection_free(gs) FREE_AND_NULL(guard_selection_t, guard_selection_free_, (gs)) MOCK_DECL(STATIC int, entry_guard_is_listed, (guard_selection_t *gs, const entry_guard_t *guard)); STATIC const char *choose_guard_selection(const or_options_t *options, @@ -573,7 +573,7 @@ STATIC entry_guard_restriction_t *guard_create_dirserver_md_restriction(void); STATIC void entry_guard_restriction_free_(entry_guard_restriction_t *rst); #define entry_guard_restriction_free(rst) \ - FREE_AND_NULL(entry_guard_restriction, (rst)) + FREE_AND_NULL(entry_guard_restriction_t, entry_guard_restriction_free_, (rst)) #endif /* defined(ENTRYNODES_PRIVATE) */ diff --git a/src/or/hs_common.h b/src/or/hs_common.h index bd20acc9ad..10b056787b 100644 --- a/src/or/hs_common.h +++ b/src/or/hs_common.h @@ -182,7 +182,7 @@ void hs_build_blinded_keypair(const ed25519_keypair_t *kp, int hs_service_requires_uptime_circ(const smartlist_t *ports); void rend_data_free_(rend_data_t *data); -#define rend_data_free(data) FREE_AND_NULL(rend_data, (data)) +#define rend_data_free(data) FREE_AND_NULL(rend_data_t, rend_data_free_, (data)) rend_data_t *rend_data_dup(const rend_data_t *data); rend_data_t *rend_data_client_create(const char *onion_address, const char *desc_id, diff --git a/src/or/hs_descriptor.h b/src/or/hs_descriptor.h index 5fa180ea50..19158e9102 100644 --- a/src/or/hs_descriptor.h +++ b/src/or/hs_descriptor.h @@ -209,17 +209,17 @@ hs_desc_is_supported_version(uint32_t version) /* Public API. */ void hs_descriptor_free_(hs_descriptor_t *desc); -#define hs_descriptor_free(desc) FREE_AND_NULL(hs_descriptor, (desc)) +#define hs_descriptor_free(desc) FREE_AND_NULL(hs_descriptor_t, hs_descriptor_free_, (desc)) void hs_desc_plaintext_data_free_(hs_desc_plaintext_data_t *desc); #define hs_desc_plaintext_data_free(desc) \ - FREE_AND_NULL(hs_desc_plaintext_data, (desc)) + FREE_AND_NULL(hs_desc_plaintext_data_t, hs_desc_plaintext_data_free_, (desc)) void hs_desc_encrypted_data_free_(hs_desc_encrypted_data_t *desc); #define hs_desc_encrypted_data_free(desc) \ - FREE_AND_NULL(hs_desc_encrypted_data, (desc)) + FREE_AND_NULL(hs_desc_encrypted_data_t, hs_desc_encrypted_data_free_, (desc)) void hs_desc_link_specifier_free_(hs_desc_link_specifier_t *ls); #define hs_desc_link_specifier_free(ls) \ - FREE_AND_NULL(hs_desc_link_specifier, (ls)) + FREE_AND_NULL(hs_desc_link_specifier_t, hs_desc_link_specifier_free_, (ls)) hs_desc_link_specifier_t *hs_desc_link_specifier_new( const extend_info_t *info, uint8_t type); @@ -243,7 +243,7 @@ size_t hs_desc_plaintext_obj_size(const hs_desc_plaintext_data_t *data); hs_desc_intro_point_t *hs_desc_intro_point_new(void); void hs_desc_intro_point_free_(hs_desc_intro_point_t *ip); -#define hs_desc_intro_point_free(ip) FREE_AND_NULL(hs_desc_intro_point, (ip)) +#define hs_desc_intro_point_free(ip) FREE_AND_NULL(hs_desc_intro_point_t, hs_desc_intro_point_free_, (ip)) link_specifier_t *hs_desc_lspec_to_trunnel( const hs_desc_link_specifier_t *spec); diff --git a/src/or/hs_ident.h b/src/or/hs_ident.h index 274772eadb..b91e5c79ba 100644 --- a/src/or/hs_ident.h +++ b/src/or/hs_ident.h @@ -120,13 +120,13 @@ hs_ident_circuit_t *hs_ident_circuit_new( const ed25519_public_key_t *identity_pk, hs_ident_circuit_type_t circuit_type); void hs_ident_circuit_free_(hs_ident_circuit_t *ident); -#define hs_ident_circuit_free(id) FREE_AND_NULL(hs_ident_circuit, (id)) +#define hs_ident_circuit_free(id) FREE_AND_NULL(hs_ident_circuit_t, hs_ident_circuit_free_, (id)) hs_ident_circuit_t *hs_ident_circuit_dup(const hs_ident_circuit_t *src); /* Directory connection identifier API. */ hs_ident_dir_conn_t *hs_ident_dir_conn_dup(const hs_ident_dir_conn_t *src); void hs_ident_dir_conn_free_(hs_ident_dir_conn_t *ident); -#define hs_ident_dir_conn_free(id) FREE_AND_NULL(hs_ident_dir_conn, (id)) +#define hs_ident_dir_conn_free(id) FREE_AND_NULL(hs_ident_dir_conn_t, hs_ident_dir_conn_free_, (id)) void hs_ident_dir_conn_init(const ed25519_public_key_t *identity_pk, const ed25519_public_key_t *blinded_pk, hs_ident_dir_conn_t *ident); @@ -135,7 +135,7 @@ void hs_ident_dir_conn_init(const ed25519_public_key_t *identity_pk, hs_ident_edge_conn_t *hs_ident_edge_conn_new( const ed25519_public_key_t *identity_pk); void hs_ident_edge_conn_free_(hs_ident_edge_conn_t *ident); -#define hs_ident_edge_conn_free(id) FREE_AND_NULL(hs_ident_edge_conn, (id)) +#define hs_ident_edge_conn_free(id) FREE_AND_NULL(hs_ident_edge_conn_t, hs_ident_edge_conn_free_, (id)) /* Validators */ int hs_ident_intro_circ_is_valid(const hs_ident_circuit_t *ident); diff --git a/src/or/hs_service.h b/src/or/hs_service.h index f933ba6ab1..bc6987dee5 100644 --- a/src/or/hs_service.h +++ b/src/or/hs_service.h @@ -250,7 +250,7 @@ void hs_service_free_all(void); /* Service new/free functions. */ hs_service_t *hs_service_new(const or_options_t *options); void hs_service_free_(hs_service_t *service); -#define hs_service_free(s) FREE_AND_NULL(hs_service, (s)) +#define hs_service_free(s) FREE_AND_NULL(hs_service_t, hs_service_free_, (s)) unsigned int hs_service_get_num_services(void); void hs_service_stage_services(const smartlist_t *service_list); @@ -296,7 +296,7 @@ STATIC hs_service_intro_point_t *service_intro_point_new( unsigned int is_legacy); STATIC void service_intro_point_free_(hs_service_intro_point_t *ip); #define service_intro_point_free(ip) \ - FREE_AND_NULL_UNMATCHED(hs_service_intro_point_t, \ + FREE_AND_NULL(hs_service_intro_point_t, \ service_intro_point_free_, (ip)) STATIC void service_intro_point_add(digest256map_t *map, hs_service_intro_point_t *ip); @@ -332,7 +332,7 @@ encode_desc_rev_counter_for_state(const hs_service_descriptor_t *desc); STATIC void service_descriptor_free_(hs_service_descriptor_t *desc); #define service_descriptor_free(d) \ - FREE_AND_NULL_UNMATCHED(hs_service_descriptor_t, \ + FREE_AND_NULL(hs_service_descriptor_t, \ service_descriptor_free_, (d)) STATIC uint64_t diff --git a/src/or/networkstatus.h b/src/or/networkstatus.h index 37350bb1b3..93fde8c2ce 100644 --- a/src/or/networkstatus.h +++ b/src/or/networkstatus.h @@ -19,10 +19,10 @@ void networkstatus_reset_download_failures(void); char *networkstatus_read_cached_consensus(const char *flavorname); int router_reload_consensus_networkstatus(void); void routerstatus_free_(routerstatus_t *rs); -#define routerstatus_free(rs) FREE_AND_NULL(routerstatus, (rs)) +#define routerstatus_free(rs) FREE_AND_NULL(routerstatus_t, routerstatus_free_, (rs)) void networkstatus_vote_free_(networkstatus_t *ns); #define networkstatus_vote_free(ns) \ - FREE_AND_NULL_UNMATCHED(networkstatus_t, networkstatus_vote_free_, (ns)) + FREE_AND_NULL(networkstatus_t, networkstatus_vote_free_, (ns)) networkstatus_voter_info_t *networkstatus_get_voter_by_id( networkstatus_t *vote, const char *identity); @@ -128,13 +128,13 @@ int32_t networkstatus_get_bw_weight(networkstatus_t *ns, const char *weight, const char *networkstatus_get_flavor_name(consensus_flavor_t flav); int networkstatus_parse_flavor_name(const char *flavname); void document_signature_free_(document_signature_t *sig); -#define document_signature_free(sig) FREE_AND_NULL(document_signature, (sig)) +#define document_signature_free(sig) FREE_AND_NULL(document_signature_t, document_signature_free_, (sig)) document_signature_t *document_signature_dup(const document_signature_t *sig); void networkstatus_free_all(void); int networkstatus_get_weight_scale_param(networkstatus_t *ns); void vote_routerstatus_free_(vote_routerstatus_t *rs); -#define vote_routerstatus_free(rs) FREE_AND_NULL(vote_routerstatus, (rs)) +#define vote_routerstatus_free(rs) FREE_AND_NULL(vote_routerstatus_t, vote_routerstatus_free_, (rs)) #ifdef NETWORKSTATUS_PRIVATE #ifdef TOR_UNIT_TESTS diff --git a/src/or/onion.h b/src/or/onion.h index 559cbb8818..48985700e3 100644 --- a/src/or/onion.h +++ b/src/or/onion.h @@ -32,7 +32,7 @@ typedef struct server_onion_keys_t { server_onion_keys_t *server_onion_keys_new(void); void server_onion_keys_free_(server_onion_keys_t *keys); -#define server_onion_keys_free(keys) FREE_AND_NULL(server_onion_keys, (keys)) +#define server_onion_keys_free(keys) FREE_AND_NULL(server_onion_keys_t, server_onion_keys_free_, (keys)) void onion_handshake_state_release(onion_handshake_state_t *state); diff --git a/src/or/onion_fast.h b/src/or/onion_fast.h index 7d110fd759..c56712e2c2 100644 --- a/src/or/onion_fast.h +++ b/src/or/onion_fast.h @@ -21,7 +21,7 @@ typedef struct fast_handshake_state_t { void fast_handshake_state_free_(fast_handshake_state_t *victim); #define fast_handshake_state_free(st) \ - FREE_AND_NULL(fast_handshake_state, (st)) + FREE_AND_NULL(fast_handshake_state_t, fast_handshake_state_free_, (st)) int fast_onionskin_create(fast_handshake_state_t **handshake_state_out, uint8_t *handshake_out); diff --git a/src/or/onion_ntor.h b/src/or/onion_ntor.h index 6ca9395dc0..f7c962b7d0 100644 --- a/src/or/onion_ntor.h +++ b/src/or/onion_ntor.h @@ -19,7 +19,7 @@ typedef struct ntor_handshake_state_t ntor_handshake_state_t; void ntor_handshake_state_free_(ntor_handshake_state_t *state); #define ntor_handshake_state_free(state) \ - FREE_AND_NULL(ntor_handshake_state, (state)) + FREE_AND_NULL(ntor_handshake_state_t, ntor_handshake_state_free_, (state)) int onion_skin_ntor_create(const uint8_t *router_id, const curve25519_public_key_t *router_key, diff --git a/src/or/policies.h b/src/or/policies.h index 451a7a7f36..55bf9012b3 100644 --- a/src/or/policies.h +++ b/src/or/policies.h @@ -117,9 +117,9 @@ int policy_write_item(char *buf, size_t buflen, const addr_policy_t *item, void addr_policy_list_free_(smartlist_t *p); #define addr_policy_list_free(lst) \ - FREE_AND_NULL_UNMATCHED(smartlist_t, addr_policy_list_free_, (lst)) + FREE_AND_NULL(smartlist_t, addr_policy_list_free_, (lst)) void addr_policy_free_(addr_policy_t *p); -#define addr_policy_free(p) FREE_AND_NULL(addr_policy, (p)) +#define addr_policy_free(p) FREE_AND_NULL(addr_policy_t, addr_policy_free_, (p)) void policies_free_all(void); char *policy_summarize(smartlist_t *policy, sa_family_t family); @@ -127,7 +127,7 @@ char *policy_summarize(smartlist_t *policy, sa_family_t family); short_policy_t *parse_short_policy(const char *summary); char *write_short_policy(const short_policy_t *policy); void short_policy_free_(short_policy_t *policy); -#define short_policy_free(p) FREE_AND_NULL(short_policy, (p)) +#define short_policy_free(p) FREE_AND_NULL(short_policy_t, short_policy_free_, (p)) int short_policy_is_reject_star(const short_policy_t *policy); addr_policy_result_t compare_tor_addr_to_short_policy( const tor_addr_t *addr, uint16_t port, diff --git a/src/or/proto_socks.h b/src/or/proto_socks.h index 423362cdec..492cd13cd1 100644 --- a/src/or/proto_socks.h +++ b/src/or/proto_socks.h @@ -12,7 +12,7 @@ struct buf_t; struct socks_request_t *socks_request_new(void); void socks_request_free_(struct socks_request_t *req); -#define socks_request_free(req) FREE_AND_NULL(socks_request, (req)) +#define socks_request_free(req) FREE_AND_NULL(socks_request_t, socks_request_free_, (req)) int fetch_from_buf_socks(struct buf_t *buf, socks_request_t *req, int log_sockstype, int safe_socks); int fetch_from_buf_socks_client(buf_t *buf, int state, char **reason); diff --git a/src/or/protover.h b/src/or/protover.h index 99e86d76b5..3c0530a3ad 100644 --- a/src/or/protover.h +++ b/src/or/protover.h @@ -84,7 +84,7 @@ STATIC const char *protocol_type_to_str(protocol_type_t pr); STATIC int str_to_protocol_type(const char *s, protocol_type_t *pr_out); STATIC void proto_entry_free_(proto_entry_t *entry); #endif -#define proto_entry_free(entry) FREE_AND_NULL(proto_entry, (entry)) +#define proto_entry_free(entry) FREE_AND_NULL(proto_entry_t, proto_entry_free_, (entry)) #endif /* defined(PROTOVER_PRIVATE) */ diff --git a/src/or/relay.h b/src/or/relay.h index 9f66aacdd6..417942adb2 100644 --- a/src/or/relay.h +++ b/src/or/relay.h @@ -52,7 +52,7 @@ int have_been_under_memory_pressure(void); /* For channeltls.c */ void packed_cell_free_(packed_cell_t *cell); -#define packed_cell_free(cell) FREE_AND_NULL(packed_cell, (cell)) +#define packed_cell_free(cell) FREE_AND_NULL(packed_cell_t, packed_cell_free_, (cell)) void cell_queue_init(cell_queue_t *queue); void cell_queue_clear(cell_queue_t *queue); @@ -96,7 +96,7 @@ typedef struct address_ttl_s { int ttl; } address_ttl_t; STATIC void address_ttl_free_(address_ttl_t *addr); -#define address_ttl_free(addr) FREE_AND_NULL(address_ttl, (addr)) +#define address_ttl_free(addr) FREE_AND_NULL(address_ttl_t, address_ttl_free_, (addr)) STATIC int resolved_cell_parse(const cell_t *cell, const relay_header_t *rh, smartlist_t *addresses_out, int *errcode_out); STATIC int connection_edge_process_resolved_cell(edge_connection_t *conn, diff --git a/src/or/rendcache.h b/src/or/rendcache.h index c1e9207a95..30e6a0cc9e 100644 --- a/src/or/rendcache.h +++ b/src/or/rendcache.h @@ -91,15 +91,15 @@ void rend_cache_increment_allocation(size_t n); STATIC size_t rend_cache_entry_allocation(const rend_cache_entry_t *e); STATIC void rend_cache_entry_free_(rend_cache_entry_t *e); -#define rend_cache_entry_free(e) FREE_AND_NULL(rend_cache_entry, (e)) +#define rend_cache_entry_free(e) FREE_AND_NULL(rend_cache_entry_t, rend_cache_entry_free_, (e)) STATIC void rend_cache_failure_intro_entry_free_(rend_cache_failure_intro_t *entry); #define rend_cache_failure_intro_entry_free(e) \ - FREE_AND_NULL_UNMATCHED(rend_cache_failure_intro_t, \ + FREE_AND_NULL(rend_cache_failure_intro_t, \ rend_cache_failure_intro_entry_free_, (e)) STATIC void rend_cache_failure_entry_free_(rend_cache_failure_t *entry); #define rend_cache_failure_entry_free(e) \ - FREE_AND_NULL_UNMATCHED(rend_cache_failure_t, \ + FREE_AND_NULL(rend_cache_failure_t, \ rend_cache_failure_entry_free_, (e)) STATIC int cache_failure_intro_lookup(const uint8_t *identity, const char *service_id, diff --git a/src/or/rendcommon.h b/src/or/rendcommon.h index 1597541153..3e1edfbcfb 100644 --- a/src/or/rendcommon.h +++ b/src/or/rendcommon.h @@ -26,14 +26,14 @@ void rend_process_relay_cell(circuit_t *circ, const crypt_path_t *layer_hint, void rend_service_descriptor_free_(rend_service_descriptor_t *desc); #define rend_service_descriptor_free(desc) \ - FREE_AND_NULL(rend_service_descriptor, (desc)) + FREE_AND_NULL(rend_service_descriptor_t, rend_service_descriptor_free_, (desc)) int rend_get_service_id(crypto_pk_t *pk, char *out); void rend_encoded_v2_service_descriptor_free_( rend_encoded_v2_service_descriptor_t *desc); #define rend_encoded_v2_service_descriptor_free(desc) \ - FREE_AND_NULL(rend_encoded_v2_service_descriptor, (desc)) + FREE_AND_NULL(rend_encoded_v2_service_descriptor_t, rend_encoded_v2_service_descriptor_free_, (desc)) void rend_intro_point_free_(rend_intro_point_t *intro); -#define rend_intro_point_free(intro) FREE_AND_NULL(rend_intro_point, (intro)) +#define rend_intro_point_free(intro) FREE_AND_NULL(rend_intro_point_t, rend_intro_point_free_, (intro)) int rend_valid_v2_service_id(const char *query); int rend_valid_descriptor_id(const char *query); diff --git a/src/or/rendservice.h b/src/or/rendservice.h index 7e9a5d6c51..8d11c76826 100644 --- a/src/or/rendservice.h +++ b/src/or/rendservice.h @@ -118,7 +118,7 @@ typedef struct rend_service_t { } rend_service_t; STATIC void rend_service_free_(rend_service_t *service); -#define rend_service_free(s) FREE_AND_NULL(rend_service, (s)) +#define rend_service_free(s) FREE_AND_NULL(rend_service_t, rend_service_free_, (s)) STATIC char *rend_service_sos_poison_path(const rend_service_t *service); STATIC int rend_service_verify_single_onion_poison( const rend_service_t *s, @@ -190,11 +190,11 @@ rend_service_port_config_t *rend_service_parse_port_config(const char *string, char **err_msg_out); void rend_service_port_config_free_(rend_service_port_config_t *p); #define rend_service_port_config_free(p) \ - FREE_AND_NULL(rend_service_port_config, (p)) + FREE_AND_NULL(rend_service_port_config_t, rend_service_port_config_free_, (p)) void rend_authorized_client_free_(rend_authorized_client_t *client); #define rend_authorized_client_free(client) \ - FREE_AND_NULL(rend_authorized_client, (client)) + FREE_AND_NULL(rend_authorized_client_t, rend_authorized_client_free_, (client)) /** Return value from rend_service_add_ephemeral. */ typedef enum { diff --git a/src/or/replaycache.h b/src/or/replaycache.h index 8f9db8c2b5..6b845b929f 100644 --- a/src/or/replaycache.h +++ b/src/or/replaycache.h @@ -34,7 +34,7 @@ struct replaycache_s { /* replaycache_t free/new */ void replaycache_free_(replaycache_t *r); -#define replaycache_free(r) FREE_AND_NULL(replaycache, (r)) +#define replaycache_free(r) FREE_AND_NULL(replaycache_t, replaycache_free_, (r)) replaycache_t * replaycache_new(time_t horizon, time_t interval); #ifdef REPLAYCACHE_PRIVATE diff --git a/src/or/router.h b/src/or/router.h index e282b9975d..696e983662 100644 --- a/src/or/router.h +++ b/src/or/router.h @@ -38,7 +38,7 @@ int get_onion_key_grace_period(void); di_digest256_map_t *construct_ntor_key_map(void); void ntor_key_map_free_(di_digest256_map_t *map); #define ntor_key_map_free(map) \ - FREE_AND_NULL_UNMATCHED(di_digest256_map_t, ntor_key_map_free_, (map)) + FREE_AND_NULL(di_digest256_map_t, ntor_key_map_free_, (map)) int router_initialize_tls_context(void); int init_keys(void); diff --git a/src/or/routerlist.h b/src/or/routerlist.h index 18f0670ead..ab510dee3f 100644 --- a/src/or/routerlist.h +++ b/src/or/routerlist.h @@ -97,11 +97,11 @@ const char *signed_descriptor_get_body(const signed_descriptor_t *desc); const char *signed_descriptor_get_annotations(const signed_descriptor_t *desc); routerlist_t *router_get_routerlist(void); void routerinfo_free_(routerinfo_t *router); -#define routerinfo_free(router) FREE_AND_NULL(routerinfo, (router)) +#define routerinfo_free(router) FREE_AND_NULL(routerinfo_t, routerinfo_free_, (router)) void extrainfo_free_(extrainfo_t *extrainfo); -#define extrainfo_free(ei) FREE_AND_NULL(extrainfo, (ei)) +#define extrainfo_free(ei) FREE_AND_NULL(extrainfo_t, extrainfo_free_, (ei)) void routerlist_free_(routerlist_t *rl); -#define routerlist_free(rl) FREE_AND_NULL(routerlist, (rl)) +#define routerlist_free(rl) FREE_AND_NULL(routerlist_t, routerlist_free_, (rl)) void dump_routerlist_mem_usage(int severity); void routerlist_remove(routerlist_t *rl, routerinfo_t *ri, int make_old, time_t now); @@ -195,7 +195,7 @@ dir_server_t *fallback_dir_server_new(const tor_addr_t *addr, void dir_server_add(dir_server_t *ent); void authority_cert_free_(authority_cert_t *cert); -#define authority_cert_free(cert) FREE_AND_NULL(authority_cert, (cert)) +#define authority_cert_free(cert) FREE_AND_NULL(authority_cert_t, authority_cert_free_, (cert)) void clear_dir_servers(void); void update_consensus_router_descriptor_downloads(time_t now, int is_vote, networkstatus_t *consensus); diff --git a/src/or/routerset.h b/src/or/routerset.h index 57b03fda36..53e8c66c5e 100644 --- a/src/or/routerset.h +++ b/src/or/routerset.h @@ -41,7 +41,7 @@ void routerset_subtract_nodes(smartlist_t *out, char *routerset_to_string(const routerset_t *routerset); int routerset_equal(const routerset_t *old, const routerset_t *new); void routerset_free_(routerset_t *routerset); -#define routerset_free(rs) FREE_AND_NULL(routerset, (rs)) +#define routerset_free(rs) FREE_AND_NULL(routerset_t, routerset_free_, (rs)) int routerset_len(const routerset_t *set); #ifdef ROUTERSET_PRIVATE diff --git a/src/or/shared_random.h b/src/or/shared_random.h index 125d50260f..675a8d8b06 100644 --- a/src/or/shared_random.h +++ b/src/or/shared_random.h @@ -114,7 +114,7 @@ char *sr_get_string_for_vote(void); char *sr_get_string_for_consensus(const smartlist_t *votes, int32_t num_srv_agreements); void sr_commit_free_(sr_commit_t *commit); -#define sr_commit_free(sr) FREE_AND_NULL(sr_commit, (sr)) +#define sr_commit_free(sr) FREE_AND_NULL(sr_commit_t, sr_commit_free_, (sr)) void sr_srv_encode(char *dst, size_t dst_len, const sr_srv_t *srv); /* Private methods (only used by shared_random_state.c): */ diff --git a/src/or/statefile.h b/src/or/statefile.h index d1b9674d45..b4cc4d1dc6 100644 --- a/src/or/statefile.h +++ b/src/or/statefile.h @@ -21,7 +21,7 @@ void or_state_free_all(void); #ifdef STATEFILE_PRIVATE STATIC config_line_t *get_transport_in_state_by_name(const char *transport); STATIC void or_state_free_(or_state_t *state); -#define or_state_free(st) FREE_AND_NULL(or_state, (st)) +#define or_state_free(st) FREE_AND_NULL(or_state_t, or_state_free_, (st)) STATIC or_state_t *or_state_new(void); #endif diff --git a/src/or/torcert.h b/src/or/torcert.h index 8e8e6e1865..0a8a252049 100644 --- a/src/or/torcert.h +++ b/src/or/torcert.h @@ -58,7 +58,7 @@ tor_cert_t *tor_cert_create(const ed25519_keypair_t *signing_key, tor_cert_t *tor_cert_parse(const uint8_t *cert, size_t certlen); void tor_cert_free_(tor_cert_t *cert); -#define tor_cert_free(cert) FREE_AND_NULL(tor_cert, (cert)) +#define tor_cert_free(cert) FREE_AND_NULL(tor_cert_t, tor_cert_free_, (cert)) int tor_cert_get_checkable_sig(ed25519_checkable_t *checkable_out, const tor_cert_t *out, @@ -86,7 +86,7 @@ rsa_ed25519_crosscert_check, (const uint8_t *crosscert, or_handshake_certs_t *or_handshake_certs_new(void); void or_handshake_certs_free_(or_handshake_certs_t *certs); #define or_handshake_certs_free(certs) \ - FREE_AND_NULL(or_handshake_certs, (certs)) + FREE_AND_NULL(or_handshake_certs_t, or_handshake_certs_free_, (certs)) int or_handshake_certs_rsa_ok(int severity, or_handshake_certs_t *certs, tor_tls_t *tls, diff --git a/src/or/transports.h b/src/or/transports.h index 9f348f58ee..1b2786472c 100644 --- a/src/or/transports.h +++ b/src/or/transports.h @@ -36,7 +36,7 @@ MOCK_DECL(int, transport_add_from_config, (const tor_addr_t *addr, uint16_t port, const char *name, int socks_ver)); void transport_free_(transport_t *transport); -#define transport_free(tr) FREE_AND_NULL(transport, (tr)) +#define transport_free(tr) FREE_AND_NULL(transport_t, transport_free_, (tr)) transport_t *transport_get_by_name(const char *name); |