aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-02-16 15:40:15 -0500
committerNick Mathewson <nickm@torproject.org>2015-02-16 15:40:15 -0500
commit5d2a23397a3775eecb35bea23edffbef40b6cd94 (patch)
tree6680efe61ba7e04c346bf7f0c9238d82d17331a7 /src/test
parent7117959199a230cc7f1684794b8b13235b5f2715 (diff)
downloadtor-5d2a23397a3775eecb35bea23edffbef40b6cd94.tar.gz
tor-5d2a23397a3775eecb35bea23edffbef40b6cd94.zip
Fix a few coverity "Use after NULL check" warnings
Also remove the unit test mocks that allowed get_options() to be NULL; that's an invariant violation for get_options().
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_status.c57
1 files changed, 0 insertions, 57 deletions
diff --git a/src/test/test_status.c b/src/test/test_status.c
index aa71aa6a9b..5e9922af0b 100644
--- a/src/test/test_status.c
+++ b/src/test/test_status.c
@@ -240,7 +240,6 @@ NS(test_main)(void *arg)
NS_DECL(double, tls_get_write_overhead_ratio, (void));
NS_DECL(int, we_are_hibernating, (void));
-NS_DECL(const or_options_t *, get_options, (void));
NS_DECL(int, public_server_mode, (const or_options_t *options));
NS_DECL(const routerinfo_t *, router_get_my_routerinfo, (void));
@@ -252,7 +251,6 @@ NS(test_main)(void *arg)
NS_MOCK(tls_get_write_overhead_ratio);
NS_MOCK(we_are_hibernating);
- NS_MOCK(get_options);
NS_MOCK(public_server_mode);
NS_MOCK(router_get_my_routerinfo);
@@ -264,7 +262,6 @@ NS(test_main)(void *arg)
done:
NS_UNMOCK(tls_get_write_overhead_ratio);
NS_UNMOCK(we_are_hibernating);
- NS_UNMOCK(get_options);
NS_UNMOCK(public_server_mode);
NS_UNMOCK(router_get_my_routerinfo);
}
@@ -281,12 +278,6 @@ NS(we_are_hibernating)(void)
return 0;
}
-static const or_options_t *
-NS(get_options)(void)
-{
- return NULL;
-}
-
static int
NS(public_server_mode)(const or_options_t *options)
{
@@ -311,7 +302,6 @@ NS(router_get_my_routerinfo)(void)
NS_DECL(double, tls_get_write_overhead_ratio, (void));
NS_DECL(int, we_are_hibernating, (void));
-NS_DECL(const or_options_t *, get_options, (void));
NS_DECL(int, public_server_mode, (const or_options_t *options));
NS_DECL(const routerinfo_t *, router_get_my_routerinfo, (void));
NS_DECL(const node_t *, node_get_by_id, (const char *identity_digest));
@@ -331,7 +321,6 @@ NS(test_main)(void *arg)
NS_MOCK(tls_get_write_overhead_ratio);
NS_MOCK(we_are_hibernating);
- NS_MOCK(get_options);
NS_MOCK(public_server_mode);
NS_MOCK(router_get_my_routerinfo);
NS_MOCK(node_get_by_id);
@@ -353,7 +342,6 @@ NS(test_main)(void *arg)
done:
NS_UNMOCK(tls_get_write_overhead_ratio);
NS_UNMOCK(we_are_hibernating);
- NS_UNMOCK(get_options);
NS_UNMOCK(public_server_mode);
NS_UNMOCK(router_get_my_routerinfo);
NS_UNMOCK(node_get_by_id);
@@ -374,12 +362,6 @@ NS(we_are_hibernating)(void)
return 0;
}
-static const or_options_t *
-NS(get_options)(void)
-{
- return NULL;
-}
-
static int
NS(public_server_mode)(const or_options_t *options)
{
@@ -472,7 +454,6 @@ NS(server_mode)(const or_options_t *options)
NS_DECL(double, tls_get_write_overhead_ratio, (void));
NS_DECL(int, we_are_hibernating, (void));
-NS_DECL(const or_options_t *, get_options, (void));
NS_DECL(int, public_server_mode, (const or_options_t *options));
NS_DECL(long, get_uptime, (void));
NS_DECL(uint64_t, get_bytes_read, (void));
@@ -489,7 +470,6 @@ NS(test_main)(void *arg)
NS_MOCK(tls_get_write_overhead_ratio);
NS_MOCK(we_are_hibernating);
- NS_MOCK(get_options);
NS_MOCK(public_server_mode);
NS_MOCK(get_uptime);
NS_MOCK(get_bytes_read);
@@ -507,7 +487,6 @@ NS(test_main)(void *arg)
done:
NS_UNMOCK(tls_get_write_overhead_ratio);
NS_UNMOCK(we_are_hibernating);
- NS_UNMOCK(get_options);
NS_UNMOCK(public_server_mode);
NS_UNMOCK(get_uptime);
NS_UNMOCK(get_bytes_read);
@@ -528,12 +507,6 @@ NS(we_are_hibernating)(void)
return 1;
}
-static const or_options_t *
-NS(get_options)(void)
-{
- return NULL;
-}
-
static int
NS(public_server_mode)(const or_options_t *options)
{
@@ -599,7 +572,6 @@ NS(server_mode)(const or_options_t *options)
NS_DECL(double, tls_get_write_overhead_ratio, (void));
NS_DECL(int, we_are_hibernating, (void));
-NS_DECL(const or_options_t *, get_options, (void));
NS_DECL(int, public_server_mode, (const or_options_t *options));
NS_DECL(long, get_uptime, (void));
NS_DECL(uint64_t, get_bytes_read, (void));
@@ -622,7 +594,6 @@ NS(test_main)(void *arg)
NS_MOCK(tls_get_write_overhead_ratio);
NS_MOCK(we_are_hibernating);
- NS_MOCK(get_options);
NS_MOCK(public_server_mode);
NS_MOCK(get_uptime);
NS_MOCK(get_bytes_read);
@@ -644,7 +615,6 @@ NS(test_main)(void *arg)
done:
NS_UNMOCK(tls_get_write_overhead_ratio);
NS_UNMOCK(we_are_hibernating);
- NS_UNMOCK(get_options);
NS_UNMOCK(public_server_mode);
NS_UNMOCK(get_uptime);
NS_UNMOCK(get_bytes_read);
@@ -669,15 +639,6 @@ NS(we_are_hibernating)(void)
return 0;
}
-static const or_options_t *
-NS(get_options)(void)
-{
- NS(mock_options) = tor_malloc_zero(sizeof(or_options_t));
- NS(mock_options)->AccountingMax = 0;
-
- return NS(mock_options);
-}
-
static int
NS(public_server_mode)(const or_options_t *options)
{
@@ -792,7 +753,6 @@ NS(get_or_state)(void)
NS_DECL(double, tls_get_write_overhead_ratio, (void));
NS_DECL(int, we_are_hibernating, (void));
-NS_DECL(const or_options_t *, get_options, (void));
NS_DECL(int, public_server_mode, (const or_options_t *options));
NS_DECL(long, get_uptime, (void));
NS_DECL(uint64_t, get_bytes_read, (void));
@@ -810,7 +770,6 @@ NS(test_main)(void *arg)
NS_MOCK(tls_get_write_overhead_ratio);
NS_MOCK(we_are_hibernating);
- NS_MOCK(get_options);
NS_MOCK(public_server_mode);
NS_MOCK(get_uptime);
NS_MOCK(get_bytes_read);
@@ -833,7 +792,6 @@ NS(test_main)(void *arg)
stats_n_data_cells_packaged = 0;
NS_UNMOCK(tls_get_write_overhead_ratio);
NS_UNMOCK(we_are_hibernating);
- NS_UNMOCK(get_options);
NS_UNMOCK(public_server_mode);
NS_UNMOCK(get_uptime);
NS_UNMOCK(get_bytes_read);
@@ -855,12 +813,6 @@ NS(we_are_hibernating)(void)
return 0;
}
-static const or_options_t *
-NS(get_options)(void)
-{
- return NULL;
-}
-
static int
NS(public_server_mode)(const or_options_t *options)
{
@@ -951,7 +903,6 @@ NS(accounting_is_enabled)(const or_options_t *options)
NS_DECL(double, tls_get_write_overhead_ratio, (void));
NS_DECL(int, we_are_hibernating, (void));
-NS_DECL(const or_options_t *, get_options, (void));
NS_DECL(int, public_server_mode, (const or_options_t *options));
NS_DECL(long, get_uptime, (void));
NS_DECL(uint64_t, get_bytes_read, (void));
@@ -969,7 +920,6 @@ NS(test_main)(void *arg)
NS_MOCK(tls_get_write_overhead_ratio);
NS_MOCK(we_are_hibernating);
- NS_MOCK(get_options);
NS_MOCK(public_server_mode);
NS_MOCK(get_uptime);
NS_MOCK(get_bytes_read);
@@ -989,7 +939,6 @@ NS(test_main)(void *arg)
done:
NS_UNMOCK(tls_get_write_overhead_ratio);
NS_UNMOCK(we_are_hibernating);
- NS_UNMOCK(get_options);
NS_UNMOCK(public_server_mode);
NS_UNMOCK(get_uptime);
NS_UNMOCK(get_bytes_read);
@@ -1011,12 +960,6 @@ NS(we_are_hibernating)(void)
return 0;
}
-static const or_options_t *
-NS(get_options)(void)
-{
- return NULL;
-}
-
static int
NS(public_server_mode)(const or_options_t *options)
{