diff --git a/src/common/address.c b/src/common/address.c index f9e5cc5c74cbd23c59bd00ce097489acf80ffeb9..f2cddd394a8a1c9ba48384ab9b5b90fda75fabba 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -40,7 +40,7 @@ #include "common/util_format.h" #include "common/address.h" #include "common/torlog.h" -#include "lib/container/container.h" +#include "lib/container/smartlist.h" #include "common/sandbox.h" #include "siphash.h" diff --git a/src/common/address.h b/src/common/address.h index b8fccd81ec9c8b39f92f9decf4cb2e29ed508340..87f29fc281ac494ba8e772fb1409f72f12dafaff 100644 --- a/src/common/address.h +++ b/src/common/address.h @@ -207,10 +207,11 @@ const char * fmt_addr32(uint32_t addr); 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 +struct smartlist_t; +void interface_address6_list_free_(struct smartlist_t * addrs);// XXXX #define 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, + FREE_AND_NULL(struct smartlist_t, interface_address6_list_free_, (addrs)) +MOCK_DECL(struct smartlist_t *,get_interface_address6_list,(int severity, sa_family_t family, int include_internal)); @@ -336,7 +337,7 @@ MOCK_DECL(int,get_interface_address,(int severity, uint32_t *addr)); * Returns NULL on failure. * Use free_interface_address_list to free the returned list. */ -static inline smartlist_t * +static inline struct smartlist_t * get_interface_address_list(int severity, int include_internal) { return get_interface_address6_list(severity, AF_INET, include_internal); @@ -347,30 +348,30 @@ int tor_addr_port_eq(const tor_addr_port_t *a, const tor_addr_port_t *b); #ifdef ADDRESS_PRIVATE -MOCK_DECL(smartlist_t *,get_interface_addresses_raw,(int severity, +MOCK_DECL(struct smartlist_t *,get_interface_addresses_raw,(int severity, sa_family_t family)); MOCK_DECL(int,get_interface_address6_via_udp_socket_hack,(int severity, sa_family_t family, tor_addr_t *addr)); #ifdef HAVE_IFADDRS_TO_SMARTLIST -STATIC smartlist_t *ifaddrs_to_smartlist(const struct ifaddrs *ifa, +STATIC struct smartlist_t *ifaddrs_to_smartlist(const struct ifaddrs *ifa, sa_family_t family); -STATIC smartlist_t *get_interface_addresses_ifaddrs(int severity, +STATIC struct smartlist_t *get_interface_addresses_ifaddrs(int severity, sa_family_t family); #endif /* defined(HAVE_IFADDRS_TO_SMARTLIST) */ #ifdef HAVE_IP_ADAPTER_TO_SMARTLIST -STATIC smartlist_t *ip_adapter_addresses_to_smartlist( +STATIC struct smartlist_t *ip_adapter_addresses_to_smartlist( const IP_ADAPTER_ADDRESSES *addresses); -STATIC smartlist_t *get_interface_addresses_win32(int severity, +STATIC struct smartlist_t *get_interface_addresses_win32(int severity, sa_family_t family); #endif /* defined(HAVE_IP_ADAPTER_TO_SMARTLIST) */ #ifdef HAVE_IFCONF_TO_SMARTLIST -STATIC smartlist_t *ifreq_to_smartlist(char *ifr, +STATIC struct smartlist_t *ifreq_to_smartlist(char *ifr, size_t buflen); -STATIC smartlist_t *get_interface_addresses_ioctl(int severity, +STATIC struct smartlist_t *get_interface_addresses_ioctl(int severity, sa_family_t family); #endif /* defined(HAVE_IFCONF_TO_SMARTLIST) */ diff --git a/src/common/compat.c b/src/common/compat.c index 577ebe7574a69bb6e25fa0159a3a79185207a2c4..9462195ba2438715e009549baaacc568fd2c72a5 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -126,7 +126,7 @@ SecureZeroMemory(PVOID ptr, SIZE_T cnt) #include "common/torlog.h" #include "common/util.h" -#include "lib/container/container.h" +#include "lib/container/smartlist.h" #include "common/address.h" #include "common/sandbox.h" @@ -3527,4 +3527,3 @@ tor_get_avail_disk_space(const char *path) return -1; #endif /* defined(HAVE_STATVFS) || ... */ } - diff --git a/src/common/confline.c b/src/common/confline.c index 7343c5f5285ea3c9ca6fe45e80ad4f4398b1f7fe..76f5ac04e57471dcfd4d41f5f0aa9bc155dd033c 100644 --- a/src/common/confline.c +++ b/src/common/confline.c @@ -8,7 +8,7 @@ #include "common/confline.h" #include "common/torlog.h" #include "common/util.h" -#include "lib/container/container.h" +#include "lib/container/smartlist.h" static int config_get_lines_aux(const char *string, config_line_t **result, int extended, int allow_include, @@ -535,4 +535,3 @@ parse_config_line_from_str_verbose(const char *line, char **key_out, return line; } - diff --git a/src/common/confline.h b/src/common/confline.h index 10af34a0a63121c6f686a0b79ade4475655def70..d1f6fdb7e51747508bf60fa1c203a2942b441796 100644 --- a/src/common/confline.h +++ b/src/common/confline.h @@ -7,7 +7,7 @@ #ifndef TOR_CONFLINE_H #define TOR_CONFLINE_H -#include "lib/container/container.h" +struct smartlist_t; /** Ordinary configuration line. */ #define CONFIG_LINE_NORMAL 0 @@ -47,7 +47,7 @@ int config_count_key(const config_line_t *a, const char *key); int config_get_lines(const char *string, config_line_t **result, int extended); int config_get_lines_include(const char *string, config_line_t **result, int extended, int *has_include, - smartlist_t *opened_lst); + struct smartlist_t *opened_lst); void config_free_lines_(config_line_t *front); #define config_free_lines(front) \ do { \ @@ -58,4 +58,3 @@ const char *parse_config_line_from_str_verbose(const char *line, char **key_out, char **value_out, const char **err_out); #endif /* !defined(TOR_CONFLINE_H) */ - diff --git a/src/common/log.c b/src/common/log.c index 8ea686a12e0596bb34903cc5c965f1e4e88e81af..5224a2197003556cb917fb0905a8b35025c24b5f 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -33,7 +33,7 @@ #include "common/util.h" #define LOG_PRIVATE #include "common/torlog.h" -#include "lib/container/container.h" +#include "lib/container/smartlist.h" #include "lib/err/torerr.h" #ifdef HAVE_ANDROID_LOG_H diff --git a/src/common/storagedir.c b/src/common/storagedir.c index f3270ce7b81b85d131a35f602ee14b8f1aeeda20..82a5e1b21d4a1a8ae6b1a809bc4818dab2d90289 100644 --- a/src/common/storagedir.c +++ b/src/common/storagedir.c @@ -1,7 +1,7 @@ /* Copyright (c) 2017-2018, The Tor Project, Inc. */ /* See LICENSE for licensing information */ -#include "lib/container/container.h" +#include "lib/container/smartlist.h" #include "common/compat.h" #include "common/confline.h" #include "common/memarea.h" @@ -583,4 +583,3 @@ storage_dir_get_max_files(storage_dir_t *d) { return d->max_files; } - diff --git a/src/common/util.c b/src/common/util.c index cd8ff93a3d9754a965ba4e66046649edb30bb754..877368af59654eb5ddbb1b20d27c5c66e52e22c7 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -18,7 +18,7 @@ #include "common/torlog.h" #include "lib/crypt_ops/crypto_digest.h" #include "lib/cc/torint.h" -#include "lib/container/container.h" +#include "lib/container/smartlist.h" #include "common/address.h" #include "common/sandbox.h" #include "lib/err/backtrace.h" diff --git a/src/common/util_bug.c b/src/common/util_bug.c index 3d86131e7c94e41b5975ac34e5f6877cd934eb73..7d6dc0750fcfc7ed5afc096b203f59266e653ab0 100644 --- a/src/common/util_bug.c +++ b/src/common/util_bug.c @@ -11,7 +11,9 @@ #include "common/util_bug.h" #include "common/torlog.h" #include "lib/err/backtrace.h" -#include "lib/container/container.h" +#ifdef TOR_UNIT_TESTS +#include "lib/container/smartlist.h" +#endif #include "lib/malloc/util_malloc.h" #ifdef __COVERITY__ diff --git a/src/lib/container/container.h b/src/lib/container/container.h index 6912ae31ea4688d4866951b65c49605184ab0491..3dc70e6353ffbdcfe4d0acc5b3d0923e11a48895 100644 --- a/src/lib/container/container.h +++ b/src/lib/container/container.h @@ -6,6 +6,4 @@ #ifndef TOR_CONTAINER_H #define TOR_CONTAINER_H -#include "lib/container/smartlist.h" - #endif /* !defined(TOR_CONTAINER_H) */ diff --git a/src/lib/crypt_ops/crypto_digest.c b/src/lib/crypt_ops/crypto_digest.c index b6ec2b28417e068ffa42eead1d700bdd1cf95b32..b1aede3a835cfb0b167572deeeaf0836d3a4e517 100644 --- a/src/lib/crypt_ops/crypto_digest.c +++ b/src/lib/crypt_ops/crypto_digest.c @@ -10,7 +10,7 @@ * operations. **/ -#include "lib/container/container.h" +#include "lib/container/smartlist.h" #include "lib/crypt_ops/crypto_digest.h" #include "lib/crypt_ops/crypto_openssl_mgt.h" #include "lib/crypt_ops/crypto_util.h" diff --git a/src/lib/crypt_ops/crypto_digest.h b/src/lib/crypt_ops/crypto_digest.h index 628224a03f2cfd2e58bc0532df540dae9439fc34..15bc5ad5b9dd91db7b0b2acdd6a23be9fad808a3 100644 --- a/src/lib/crypt_ops/crypto_digest.h +++ b/src/lib/crypt_ops/crypto_digest.h @@ -13,7 +13,6 @@ #ifndef TOR_CRYPTO_DIGEST_H #define TOR_CRYPTO_DIGEST_H -#include "lib/container/container.h" #include "lib/cc/torint.h" #include "lib/defs/digest_sizes.h" #include "lib/malloc/util_malloc.h" @@ -70,6 +69,8 @@ typedef struct { typedef struct crypto_digest_t crypto_digest_t; typedef struct crypto_xof_t crypto_xof_t; +struct smartlist_t; + /* SHA-1 and other digests */ int crypto_digest(char *digest, const char *m, size_t len); int crypto_digest256(char *digest, const char *m, size_t len, diff --git a/src/lib/crypt_ops/crypto_format.c b/src/lib/crypt_ops/crypto_format.c index 246f28716acddde36277ed1b52b783ca40b25081..2d28090aaa3e524371a28fe2ca0016ef93722185 100644 --- a/src/lib/crypt_ops/crypto_format.c +++ b/src/lib/crypt_ops/crypto_format.c @@ -14,7 +14,7 @@ #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> #endif -#include "lib/container/container.h" +#include "lib/container/smartlist.h" #include "lib/crypt_ops/crypto_curve25519.h" #include "lib/crypt_ops/crypto_digest.h" #include "lib/crypt_ops/crypto_ed25519.h" @@ -296,4 +296,3 @@ digest256_from_base64(char *digest, const char *d64) else return -1; } - diff --git a/src/lib/crypt_ops/crypto_rand.c b/src/lib/crypt_ops/crypto_rand.c index af258abea429c42568644c7b6be9c099a7f841c0..0d41a207e848669c516d136a5949cc50277de5b1 100644 --- a/src/lib/crypt_ops/crypto_rand.c +++ b/src/lib/crypt_ops/crypto_rand.c @@ -21,7 +21,7 @@ #include <wincrypt.h> #endif /* defined(_WIN32) */ -#include "lib/container/container.h" +#include "lib/container/smartlist.h" #include "common/compat.h" #include "lib/crypt_ops/compat_openssl.h" #include "lib/crypt_ops/crypto_util.h" @@ -612,4 +612,3 @@ crypto_force_rand_ssleay(void) } #endif /* !defined(CRYPTO_RAND_PRIVATE) */ - diff --git a/src/lib/tls/tortls.c b/src/lib/tls/tortls.c index ea3a4205412e9364f3f764c62edbb6fb78af1aad..eb8a91b4205e40eae9f25a1059122ffd952f4da6 100644 --- a/src/lib/tls/tortls.c +++ b/src/lib/tls/tortls.c @@ -55,7 +55,7 @@ ENABLE_GCC_WARNING(redundant-decls) #include "lib/tls/tortls.h" #include "common/util.h" #include "common/torlog.h" -#include "lib/container/container.h" +#include "lib/container/smartlist.h" #include <string.h> #ifdef OPENSSL_1_1_API diff --git a/src/or/parsecommon.c b/src/or/parsecommon.c index 09c7d665fe4063c95bfe77fdbf16f8de8c2b47dc..298d3658ba3fcdb0f11de1c42f6b2495e4518ad7 100644 --- a/src/or/parsecommon.c +++ b/src/or/parsecommon.c @@ -9,6 +9,7 @@ #include "or/parsecommon.h" #include "common/torlog.h" #include "common/util_format.h" +#include "lib/container/smartlist.h" #define MIN_ANNOTATION A_PURPOSE #define MAX_ANNOTATION A_UNKNOWN_ @@ -448,4 +449,3 @@ find_all_by_keyword(const smartlist_t *s, directory_keyword k) }); return out; } - diff --git a/src/or/parsecommon.h b/src/or/parsecommon.h index c786bcc5480bac22d73d54c3e80316ac44e8a92c..fc61c514a19e8c1a34f3587d4c7bf1627139bc97 100644 --- a/src/or/parsecommon.h +++ b/src/or/parsecommon.h @@ -9,10 +9,11 @@ #ifndef TOR_PARSECOMMON_H #define TOR_PARSECOMMON_H -#include "lib/container/container.h" #include "lib/crypt_ops/crypto.h" #include "common/memarea.h" +struct smartlist_t; + /** Enumeration of possible token types. The ones starting with K_ correspond * to directory 'keywords'. A_ is for an annotation, R or C is related to * hidden services, ERR_ is an error in the tokenizing process, EOF_ is an @@ -299,7 +300,7 @@ void token_clear(directory_token_t *tok); int tokenize_string(memarea_t *area, const char *start, const char *end, - smartlist_t *out, + struct smartlist_t *out, token_rule_t *table, int flags); directory_token_t *get_next_token(memarea_t *area, @@ -307,16 +308,16 @@ directory_token_t *get_next_token(memarea_t *area, const char *eos, token_rule_t *table); -directory_token_t *find_by_keyword_(smartlist_t *s, +directory_token_t *find_by_keyword_(struct smartlist_t *s, directory_keyword keyword, const char *keyword_str); #define find_by_keyword(s, keyword) \ find_by_keyword_((s), (keyword), #keyword) -directory_token_t *find_opt_by_keyword(const smartlist_t *s, +directory_token_t *find_opt_by_keyword(const struct smartlist_t *s, directory_keyword keyword); -smartlist_t * find_all_by_keyword(const smartlist_t *s, directory_keyword k); +struct smartlist_t * find_all_by_keyword(const struct smartlist_t *s, + directory_keyword k); #endif /* !defined(TOR_PARSECOMMON_H) */ - diff --git a/src/or/protover.h b/src/or/protover.h index 99502645caaa61ffb1b2c4794eadbd857ea35537..aab311e96ffd2c5d17945b5ad42d7d75e1ebb994 100644 --- a/src/or/protover.h +++ b/src/or/protover.h @@ -9,7 +9,7 @@ #ifndef TOR_PROTOVER_H #define TOR_PROTOVER_H -#include "lib/container/container.h" +struct smartlist_t; /** The first version of Tor that included "proto" entries in its * descriptors. Authorities should use this to decide whether to @@ -47,7 +47,7 @@ int protover_all_supported(const char *s, char **missing); int protover_is_supported_here(protocol_type_t pr, uint32_t ver); const char *protover_get_supported_protocols(void); -char *protover_compute_vote(const smartlist_t *list_of_proto_strings, +char *protover_compute_vote(const struct smartlist_t *list_of_proto_strings, int threshold); const char *protover_compute_for_old_tor(const char *version); int protocol_list_supports_protocol(const char *list, protocol_type_t tp, @@ -75,12 +75,12 @@ typedef struct proto_entry_t { */ char *name; /** Smartlist of proto_range_t */ - smartlist_t *ranges; + struct smartlist_t *ranges; } proto_entry_t; #if !defined(HAVE_RUST) && defined(TOR_UNIT_TESTS) -STATIC smartlist_t *parse_protocol_list(const char *s); -STATIC char *encode_protocol_list(const smartlist_t *sl); +STATIC struct smartlist_t *parse_protocol_list(const char *s); +STATIC char *encode_protocol_list(const struct smartlist_t *sl); 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); @@ -92,4 +92,3 @@ STATIC void proto_entry_free_(proto_entry_t *entry); #endif /* defined(PROTOVER_PRIVATE) */ #endif /* !defined(TOR_PROTOVER_H) */ -