Extract smartlist.h from container.h

This commit is contained in:
Nick Mathewson 2018-06-21 17:00:48 -04:00
parent 9cf6fc91b1
commit de508c5f50
18 changed files with 42 additions and 46 deletions

View File

@ -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"

View File

@ -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) */

View File

@ -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) || ... */
}

View File

@ -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;
}

View File

@ -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) */

View File

@ -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

View File

@ -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;
}

View File

@ -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"

View File

@ -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__

View File

@ -6,6 +6,4 @@
#ifndef TOR_CONTAINER_H
#define TOR_CONTAINER_H
#include "lib/container/smartlist.h"
#endif /* !defined(TOR_CONTAINER_H) */

View File

@ -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"

View File

@ -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,

View File

@ -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;
}

View File

@ -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) */

View File

@ -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

View File

@ -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;
}

View File

@ -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) */

View File

@ -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) */