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

[tor-commits] [tor/master] Replace all FREE_AND_NULL* uses to take a type and a free function.



commit 285632a61b4e4aeec07b26004396473e0d8f4a43
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu Dec 7 10:44:04 2017 -0500

    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\(/;
---
 src/common/address.h         |  2 +-
 src/common/aes.h             |  2 +-
 src/common/buffers.h         |  2 +-
 src/common/compat_libevent.h |  4 ++--
 src/common/compat_threads.h  |  4 ++--
 src/common/compress.h        |  2 +-
 src/common/compress_lzma.h   |  2 +-
 src/common/compress_zlib.h   |  2 +-
 src/common/compress_zstd.h   |  2 +-
 src/common/container.h       |  6 +++---
 src/common/crypto.h          | 10 +++++-----
 src/common/crypto_ed25519.h  |  2 +-
 src/common/log.c             |  2 +-
 src/common/procmon.h         |  2 +-
 src/common/storagedir.h      |  2 +-
 src/common/timers.h          |  2 +-
 src/common/tortls.h          |  4 ++--
 src/common/util.h            |  2 +-
 src/or/channel.h             |  6 +++---
 src/or/circuitbuild.h        |  2 +-
 src/or/circuitlist.h         |  2 +-
 src/or/circuitmux.h          |  2 +-
 src/or/config.h              |  2 +-
 src/or/connection.h          |  2 +-
 src/or/connection_or.h       |  4 ++--
 src/or/conscache.h           |  4 ++--
 src/or/dircollate.h          |  2 +-
 src/or/directory.h           |  2 +-
 src/or/dirserv.h             |  2 +-
 src/or/dirvote.h             |  2 +-
 src/or/entrynodes.h          |  6 +++---
 src/or/hs_common.h           |  2 +-
 src/or/hs_descriptor.h       | 10 +++++-----
 src/or/hs_ident.h            |  6 +++---
 src/or/hs_service.h          |  6 +++---
 src/or/networkstatus.h       |  8 ++++----
 src/or/onion.h               |  2 +-
 src/or/onion_fast.h          |  2 +-
 src/or/onion_ntor.h          |  2 +-
 src/or/policies.h            |  6 +++---
 src/or/proto_socks.h         |  2 +-
 src/or/protover.h            |  2 +-
 src/or/relay.h               |  4 ++--
 src/or/rendcache.h           |  6 +++---
 src/or/rendcommon.h          |  6 +++---
 src/or/rendservice.h         |  6 +++---
 src/or/replaycache.h         |  2 +-
 src/or/router.h              |  2 +-
 src/or/routerlist.h          |  8 ++++----
 src/or/routerset.h           |  2 +-
 src/or/shared_random.h       |  2 +-
 src/or/statefile.h           |  2 +-
 src/or/torcert.h             |  4 ++--
 src/or/transports.h          |  2 +-
 src/test/test_handles.c      |  2 +-
 55 files changed, 94 insertions(+), 94 deletions(-)

diff --git a/src/common/address.h b/src/common/address.h
index 6f59e1c96..7607c76ba 100644
--- a/src/common/address.h
+++ b/src/common/address.h
@@ -208,7 +208,7 @@ MOCK_DECL(int,get_interface_address6,(int severity, sa_family_t family,
 tor_addr_t *addr));
 void interface_address6_list_free_(smartlist_t * addrs);// XXXX
 #define interface_address6_list_free(addrs) \
-  FREE_AND_NULL_UNMATCHED(smartlist_t, interface_address6_list_free_, (addrs))
+  FREE_AND_NULL(smartlist_t, interface_address6_list_free_, (addrs))
 MOCK_DECL(smartlist_t *,get_interface_address6_list,(int severity,
                                                      sa_family_t family,
                                                      int include_internal));
diff --git a/src/common/aes.h b/src/common/aes.h
index c2720d29b..0b17cd55a 100644
--- a/src/common/aes.h
+++ b/src/common/aes.h
@@ -19,7 +19,7 @@ aes_cnt_cipher_t* aes_new_cipher(const uint8_t *key, const uint8_t *iv,
                                  int key_bits);
 void aes_cipher_free_(aes_cnt_cipher_t *cipher);
 #define aes_cipher_free(cipher) \
-  FREE_AND_NULL_UNMATCHED(aes_cnt_cipher_t, aes_cipher_free_, (cipher))
+  FREE_AND_NULL(aes_cnt_cipher_t, aes_cipher_free_, (cipher))
 void aes_crypt_inplace(aes_cnt_cipher_t *cipher, char *data, size_t len);
 
 int evaluate_evp_for_aes(int force_value);
diff --git a/src/common/buffers.h b/src/common/buffers.h
index 34e9711b2..43a8043b5 100644
--- a/src/common/buffers.h
+++ b/src/common/buffers.h
@@ -25,7 +25,7 @@ buf_t *buf_new(void);
 buf_t *buf_new_with_capacity(size_t size);
 size_t buf_get_default_chunk_size(const buf_t *buf);
 void buf_free_(buf_t *buf);
-#define buf_free(b) FREE_AND_NULL(buf, (b))
+#define buf_free(b) FREE_AND_NULL(buf_t, buf_free_, (b))
 void buf_clear(buf_t *buf);
 buf_t *buf_copy(const buf_t *buf);
 
diff --git a/src/common/compat_libevent.h b/src/common/compat_libevent.h
index 2c86194d0..086899ad1 100644
--- a/src/common/compat_libevent.h
+++ b/src/common/compat_libevent.h
@@ -21,7 +21,7 @@ void suppress_libevent_log_msg(const char *msg);
 
 void tor_event_free_(struct event *ev);
 #define tor_event_free(ev) \
-  FREE_AND_NULL_UNMATCHED(struct event, tor_event_free_, (ev))
+  FREE_AND_NULL(struct event, tor_event_free_, (ev))
 
 typedef struct periodic_timer_t periodic_timer_t;
 
@@ -30,7 +30,7 @@ periodic_timer_t *periodic_timer_new(struct event_base *base,
              void (*cb)(periodic_timer_t *timer, void *data),
              void *data);
 void periodic_timer_free_(periodic_timer_t *);
-#define periodic_timer_free(t) FREE_AND_NULL(periodic_timer, (t))
+#define periodic_timer_free(t) FREE_AND_NULL(periodic_timer_t, periodic_timer_free_, (t))
 
 #define tor_event_base_loopexit event_base_loopexit
 #define tor_event_base_loopbreak event_base_loopbreak
diff --git a/src/common/compat_threads.h b/src/common/compat_threads.h
index 26e291ae6..0f420cb81 100644
--- a/src/common/compat_threads.h
+++ b/src/common/compat_threads.h
@@ -51,7 +51,7 @@ void tor_mutex_init_nonrecursive(tor_mutex_t *m);
 void tor_mutex_acquire(tor_mutex_t *m);
 void tor_mutex_release(tor_mutex_t *m);
 void tor_mutex_free_(tor_mutex_t *m);
-#define tor_mutex_free(m) FREE_AND_NULL(tor_mutex, (m))
+#define tor_mutex_free(m) FREE_AND_NULL(tor_mutex_t, tor_mutex_free_, (m))
 void tor_mutex_uninit(tor_mutex_t *m);
 unsigned long tor_get_thread_id(void);
 void tor_threads_init(void);
@@ -79,7 +79,7 @@ typedef struct tor_cond_t {
 
 tor_cond_t *tor_cond_new(void);
 void tor_cond_free_(tor_cond_t *cond);
-#define tor_cond_free(c) FREE_AND_NULL(tor_cond, (c))
+#define tor_cond_free(c) FREE_AND_NULL(tor_cond_t, tor_cond_free_, (c))
 int tor_cond_init(tor_cond_t *cond);
 void tor_cond_uninit(tor_cond_t *cond);
 int tor_cond_wait(tor_cond_t *cond, tor_mutex_t *mutex,
diff --git a/src/common/compress.h b/src/common/compress.h
index 7420f169f..952102bf9 100644
--- a/src/common/compress.h
+++ b/src/common/compress.h
@@ -82,7 +82,7 @@ tor_compress_output_t tor_compress_process(tor_compress_state_t *state,
                                            int finish);
 void tor_compress_free_(tor_compress_state_t *state);
 #define tor_compress_free(st) \
-  FREE_AND_NULL_UNMATCHED(tor_compress_state_t, tor_compress_free_, (st))
+  FREE_AND_NULL(tor_compress_state_t, tor_compress_free_, (st))
 
 size_t tor_compress_state_size(const tor_compress_state_t *state);
 
diff --git a/src/common/compress_lzma.h b/src/common/compress_lzma.h
index 986bfe9a6..38a447c1f 100644
--- a/src/common/compress_lzma.h
+++ b/src/common/compress_lzma.h
@@ -33,7 +33,7 @@ tor_lzma_compress_process(tor_lzma_compress_state_t *state,
 
 void tor_lzma_compress_free_(tor_lzma_compress_state_t *state);
 #define tor_lzma_compress_free(st)                      \
-  FREE_AND_NULL_UNMATCHED(tor_lzma_compress_state_t,   \
+  FREE_AND_NULL(tor_lzma_compress_state_t,   \
                            tor_lzma_compress_free_, (st))
 
 size_t tor_lzma_compress_state_size(const tor_lzma_compress_state_t *state);
diff --git a/src/common/compress_zlib.h b/src/common/compress_zlib.h
index 701e2f9e8..e3c1a2b33 100644
--- a/src/common/compress_zlib.h
+++ b/src/common/compress_zlib.h
@@ -33,7 +33,7 @@ tor_zlib_compress_process(tor_zlib_compress_state_t *state,
 
 void tor_zlib_compress_free_(tor_zlib_compress_state_t *state);
 #define tor_zlib_compress_free(st)                      \
-  FREE_AND_NULL_UNMATCHED(tor_zlib_compress_state_t,   \
+  FREE_AND_NULL(tor_zlib_compress_state_t,   \
                            tor_zlib_compress_free_, (st))
 
 size_t tor_zlib_compress_state_size(const tor_zlib_compress_state_t *state);
diff --git a/src/common/compress_zstd.h b/src/common/compress_zstd.h
index 3e18febb1..9bca24ded 100644
--- a/src/common/compress_zstd.h
+++ b/src/common/compress_zstd.h
@@ -33,7 +33,7 @@ tor_zstd_compress_process(tor_zstd_compress_state_t *state,
 
 void tor_zstd_compress_free_(tor_zstd_compress_state_t *state);
 #define tor_zstd_compress_free(st)                      \
-  FREE_AND_NULL_UNMATCHED(tor_zstd_compress_state_t,   \
+  FREE_AND_NULL(tor_zstd_compress_state_t,   \
                            tor_zstd_compress_free_, (st))
 
 size_t tor_zstd_compress_state_size(const tor_zstd_compress_state_t *state);
diff --git a/src/common/container.h b/src/common/container.h
index 95dfa4c90..5d2dce541 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -29,7 +29,7 @@ typedef struct smartlist_t {
 
 MOCK_DECL(smartlist_t *, smartlist_new, (void));
 MOCK_DECL(void, smartlist_free_, (smartlist_t *sl));
-#define smartlist_free(sl) FREE_AND_NULL(smartlist, (sl))
+#define smartlist_free(sl) FREE_AND_NULL(smartlist_t, smartlist_free_, (sl))
 
 void smartlist_clear(smartlist_t *sl);
 void smartlist_add(smartlist_t *sl, void *element);
@@ -630,7 +630,7 @@ bitarray_free_(bitarray_t *ba)
 {
   tor_free(ba);
 }
-#define bitarray_free(ba) FREE_AND_NULL(bitarray, (ba))
+#define bitarray_free(ba) FREE_AND_NULL(bitarray_t, bitarray_free_, (ba))
 
 /** Set the <b>bit</b>th bit in <b>b</b> to 1. */
 static inline void
@@ -694,7 +694,7 @@ digestset_contains(const digestset_t *set, const char *digest)
 
 digestset_t *digestset_new(int max_elements);
 void digestset_free_(digestset_t* set);
-#define digestset_free(set) FREE_AND_NULL(digestset, (set))
+#define digestset_free(set) FREE_AND_NULL(digestset_t, digestset_free_, (set))
 
 /* These functions, given an <b>array</b> of <b>n_elements</b>, return the
  * <b>nth</b> lowest element. <b>nth</b>=0 gives the lowest element;
diff --git a/src/common/crypto.h b/src/common/crypto.h
index f1061467d..30023bad9 100644
--- a/src/common/crypto.h
+++ b/src/common/crypto.h
@@ -148,7 +148,7 @@ int crypto_global_cleanup(void);
 /* environment setup */
 MOCK_DECL(crypto_pk_t *,crypto_pk_new,(void));
 void crypto_pk_free_(crypto_pk_t *env);
-#define crypto_pk_free(pk) FREE_AND_NULL(crypto_pk, (pk))
+#define crypto_pk_free(pk) FREE_AND_NULL(crypto_pk_t, crypto_pk_free_, (pk))
 
 void crypto_set_tls_dh_prime(void);
 crypto_cipher_t *crypto_cipher_new(const char *key);
@@ -158,7 +158,7 @@ crypto_cipher_t *crypto_cipher_new_with_iv_and_bits(const uint8_t *key,
                                                     const uint8_t *iv,
                                                     int bits);
 void crypto_cipher_free_(crypto_cipher_t *env);
-#define crypto_cipher_free(c) FREE_AND_NULL(crypto_cipher, (c))
+#define crypto_cipher_free(c) FREE_AND_NULL(crypto_cipher_t, crypto_cipher_free_, (c))
 
 /* public key crypto */
 MOCK_DECL(int, crypto_pk_generate_key_with_bits,(crypto_pk_t *env, int bits));
@@ -262,7 +262,7 @@ crypto_digest_t *crypto_digest_new(void);
 crypto_digest_t *crypto_digest256_new(digest_algorithm_t algorithm);
 crypto_digest_t *crypto_digest512_new(digest_algorithm_t algorithm);
 void crypto_digest_free_(crypto_digest_t *digest);
-#define crypto_digest_free(d) FREE_AND_NULL(crypto_digest, (d))
+#define crypto_digest_free(d) FREE_AND_NULL(crypto_digest_t, crypto_digest_free_, (d))
 void crypto_digest_add_bytes(crypto_digest_t *digest, const char *data,
                              size_t len);
 void crypto_digest_get_digest(crypto_digest_t *digest,
@@ -281,7 +281,7 @@ crypto_xof_t *crypto_xof_new(void);
 void crypto_xof_add_bytes(crypto_xof_t *xof, const uint8_t *data, size_t len);
 void crypto_xof_squeeze_bytes(crypto_xof_t *xof, uint8_t *out, size_t len);
 void crypto_xof_free_(crypto_xof_t *xof);
-#define crypto_xof_free(xof) FREE_AND_NULL(crypto_xof, (xof))
+#define crypto_xof_free(xof) FREE_AND_NULL(crypto_xof_t, crypto_xof_free_, (xof))
 
 /* Key negotiation */
 #define DH_TYPE_CIRCUIT 1
@@ -297,7 +297,7 @@ ssize_t crypto_dh_compute_secret(int severity, crypto_dh_t *dh,
                              const char *pubkey, size_t pubkey_len,
                              char *secret_out, size_t secret_out_len);
 void crypto_dh_free_(crypto_dh_t *dh);
-#define crypto_dh_free(dh) FREE_AND_NULL(crypto_dh, (dh))
+#define crypto_dh_free(dh) FREE_AND_NULL(crypto_dh_t, crypto_dh_free_, (dh))
 
 int crypto_expand_key_material_TAP(const uint8_t *key_in,
                                    size_t key_in_len,
diff --git a/src/common/crypto_ed25519.h b/src/common/crypto_ed25519.h
index 64ccc470e..c05f5dfa9 100644
--- a/src/common/crypto_ed25519.h
+++ b/src/common/crypto_ed25519.h
@@ -119,7 +119,7 @@ int ed25519_pubkey_read_from_file(ed25519_public_key_t *pubkey_out,
                                   const char *filename);
 
 void ed25519_keypair_free_(ed25519_keypair_t *kp);
-#define ed25519_keypair_free(kp) FREE_AND_NULL(ed25519_keypair, (kp))
+#define ed25519_keypair_free(kp) FREE_AND_NULL(ed25519_keypair_t, ed25519_keypair_free_, (kp))
 
 int ed25519_pubkey_eq(const ed25519_public_key_t *key1,
                       const ed25519_public_key_t *key2);
diff --git a/src/common/log.c b/src/common/log.c
index d305c9ae5..9d4219be1 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -65,7 +65,7 @@ typedef struct logfile_t {
 
 static void log_free_(logfile_t *victim);
 #define log_free(lg)    \
-  FREE_AND_NULL_UNMATCHED(logfile_t, log_free_, (lg))
+  FREE_AND_NULL(logfile_t, log_free_, (lg))
 
 /** Helper: map a log severity to descriptive string. */
 static inline const char *
diff --git a/src/common/procmon.h b/src/common/procmon.h
index 691a5a124..63777e411 100644
--- a/src/common/procmon.h
+++ b/src/common/procmon.h
@@ -29,7 +29,7 @@ tor_process_monitor_t *tor_process_monitor_new(struct event_base *base,
                                                const char **msg);
 void tor_process_monitor_free_(tor_process_monitor_t *procmon);
 #define tor_process_monitor_free(procmon) \
-  FREE_AND_NULL(tor_process_monitor, (procmon))
+  FREE_AND_NULL(tor_process_monitor_t, tor_process_monitor_free_, (procmon))
 
 #endif /* !defined(TOR_PROCMON_H) */
 
diff --git a/src/common/storagedir.h b/src/common/storagedir.h
index 8408ab50d..0ddb65542 100644
--- a/src/common/storagedir.h
+++ b/src/common/storagedir.h
@@ -10,7 +10,7 @@ struct sandbox_cfg_elem;
 
 storage_dir_t * storage_dir_new(const char *dirname, int n_files);
 void storage_dir_free_(storage_dir_t *d);
-#define storage_dir_free(d) FREE_AND_NULL(storage_dir, (d))
+#define storage_dir_free(d) FREE_AND_NULL(storage_dir_t, storage_dir_free_, (d))
 
 int storage_dir_register_with_sandbox(storage_dir_t *d,
                                       struct sandbox_cfg_elem **cfg);
diff --git a/src/common/timers.h b/src/common/timers.h
index 86e892016..6d27f3e01 100644
--- a/src/common/timers.h
+++ b/src/common/timers.h
@@ -18,7 +18,7 @@ void timer_get_cb(const tor_timer_t *t,
 void timer_schedule(tor_timer_t *t, const struct timeval *delay);
 void timer_disable(tor_timer_t *t);
 void timer_free_(tor_timer_t *t);
-#define timer_free(t) FREE_AND_NULL_UNMATCHED(tor_timer_t, timer_free_, (t))
+#define timer_free(t) FREE_AND_NULL(tor_timer_t, timer_free_, (t))
 
 void timers_initialize(void);
 void timers_shutdown(void);
diff --git a/src/common/tortls.h b/src/common/tortls.h
index b293ce20e..df8597db0 100644
--- a/src/common/tortls.h
+++ b/src/common/tortls.h
@@ -217,7 +217,7 @@ void tor_tls_set_renegotiate_callback(tor_tls_t *tls,
                                       void *arg);
 int tor_tls_is_server(tor_tls_t *tls);
 void tor_tls_free_(tor_tls_t *tls);
-#define tor_tls_free(tls) FREE_AND_NULL(tor_tls, (tls))
+#define tor_tls_free(tls) FREE_AND_NULL(tor_tls_t, tor_tls_free_, (tls))
 int tor_tls_peer_has_cert(tor_tls_t *tls);
 MOCK_DECL(tor_x509_cert_t *,tor_tls_get_peer_cert,(tor_tls_t *tls));
 MOCK_DECL(tor_x509_cert_t *,tor_tls_get_own_cert,(tor_tls_t *tls));
@@ -265,7 +265,7 @@ void tor_tls_log_one_error(tor_tls_t *tls, unsigned long err,
                            int severity, int domain, const char *doing);
 
 void tor_x509_cert_free_(tor_x509_cert_t *cert);
-#define tor_x509_cert_free(c) FREE_AND_NULL(tor_x509_cert, (c))
+#define tor_x509_cert_free(c) FREE_AND_NULL(tor_x509_cert_t, tor_x509_cert_free_, (c))
 tor_x509_cert_t *tor_x509_cert_decode(const uint8_t *certificate,
                             size_t certificate_len);
 void tor_x509_cert_get_der(const tor_x509_cert_t *cert,
diff --git a/src/common/util.h b/src/common/util.h
index 97ad15f83..8dc64ce9f 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -446,7 +446,7 @@ struct process_environment_t {
 process_environment_t *process_environment_make(struct smartlist_t *env_vars);
 void process_environment_free_(process_environment_t *env);
 #define process_environment_free(env) \
-  FREE_AND_NULL(process_environment, (env))
+  FREE_AND_NULL(process_environment_t, process_environment_free_, (env))
 
 struct smartlist_t *get_current_process_environment_variables(void);
 
diff --git a/src/or/channel.h b/src/or/channel.h
index 0ee99dcaf..1ff226d37 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 6c3c91f83..68c6d9ea7 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 ffa250b2c..bf3393a94 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 e7f345f67..689decee8 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 cc8003fb3..c591a8e54 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 d1811c79b..9ba1606d6 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 107af491e..986b8cec4 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 0c02f6ebc..501917bd0 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 ab44c83b0..f165bdfaf 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 89913038e..08ed5024d 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 037294bdb..7c5006b18 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 29fb07273..6a02ea3e3 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 5fd4c970d..32fcfeadf 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 bd20acc9a..10b056787 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 5fa180ea5..19158e910 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 274772ead..b91e5c79b 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 f933ba6ab..bc6987dee 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 37350bb1b..93fde8c2c 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 559cbb881..48985700e 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 7d110fd75..c56712e2c 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 6ca9395dc..f7c962b7d 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 451a7a7f3..55bf9012b 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 423362cde..492cd13cd 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 99e86d76b..3c0530a3a 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 9f66aacdd..417942adb 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 c1e9207a9..30e6a0cc9 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 159754115..3e1edfbcf 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 7e9a5d6c5..8d11c7682 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 8f9db8c2b..6b845b929 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 e282b9975..696e98366 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 18f0670ea..ab510dee3 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 57b03fda3..53e8c66c5 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 125d50260..675a8d8b0 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 d1b9674d4..b4cc4d1dc 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 8e8e6e186..0a8a25204 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 9f348f58e..1b2786472 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);
 
diff --git a/src/test/test_handles.c b/src/test/test_handles.c
index 03ae0883c..eb1e1f1bb 100644
--- a/src/test/test_handles.c
+++ b/src/test/test_handles.c
@@ -14,7 +14,7 @@ typedef struct demo_t {
 
 HANDLE_DECL(demo, demo_t, static)
 #define demo_handle_free(h)    \
-  FREE_AND_NULL(demo_handle, (h))
+  FREE_AND_NULL(demo_handle_t, demo_handle_free_, (h))
 HANDLE_IMPL(demo, demo_t, static)
 
 static demo_t *



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits