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/common | |
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/common')
-rw-r--r-- | src/common/address.h | 2 | ||||
-rw-r--r-- | src/common/aes.h | 2 | ||||
-rw-r--r-- | src/common/buffers.h | 2 | ||||
-rw-r--r-- | src/common/compat_libevent.h | 4 | ||||
-rw-r--r-- | src/common/compat_threads.h | 4 | ||||
-rw-r--r-- | src/common/compress.h | 2 | ||||
-rw-r--r-- | src/common/compress_lzma.h | 2 | ||||
-rw-r--r-- | src/common/compress_zlib.h | 2 | ||||
-rw-r--r-- | src/common/compress_zstd.h | 2 | ||||
-rw-r--r-- | src/common/container.h | 6 | ||||
-rw-r--r-- | src/common/crypto.h | 10 | ||||
-rw-r--r-- | src/common/crypto_ed25519.h | 2 | ||||
-rw-r--r-- | src/common/log.c | 2 | ||||
-rw-r--r-- | src/common/procmon.h | 2 | ||||
-rw-r--r-- | src/common/storagedir.h | 2 | ||||
-rw-r--r-- | src/common/timers.h | 2 | ||||
-rw-r--r-- | src/common/tortls.h | 4 | ||||
-rw-r--r-- | src/common/util.h | 2 |
18 files changed, 27 insertions, 27 deletions
diff --git a/src/common/address.h b/src/common/address.h index 6f59e1c962..7607c76bae 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 c2720d29b8..0b17cd55a4 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 34e9711b24..43a8043b56 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 2c86194d04..086899ad18 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 26e291ae60..0f420cb818 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 7420f169fd..952102bf97 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 986bfe9a67..38a447c1f3 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 701e2f9e89..e3c1a2b339 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 3e18febb12..9bca24ded7 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 95dfa4c90f..5d2dce5416 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 f1061467d5..30023bad9f 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 64ccc470ea..c05f5dfa9e 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 d305c9ae5e..9d4219be1a 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 691a5a124b..63777e4111 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 8408ab50d2..0ddb65542e 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 86e8920169..6d27f3e01e 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 b293ce20e4..df8597db02 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 97ad15f834..8dc64ce9fa 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); |