diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-07-23 10:13:29 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-07-24 15:21:56 -0400 |
commit | 57e87cc86cce0b9fb351b1862f99c84bfa8100eb (patch) | |
tree | 38b5ba153f209fe127ad61a95cf30c9adf4443fa /src/test | |
parent | a1b2817abefc5c696e469fa4fd8a09cc5f286aa6 (diff) | |
download | tor-57e87cc86cce0b9fb351b1862f99c84bfa8100eb.tar.gz tor-57e87cc86cce0b9fb351b1862f99c84bfa8100eb.zip |
Use config_new() to construct configuration objects.
We'll need to do it this way once the objects become more complex.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/fuzz/fuzzing_common.c | 2 | ||||
-rw-r--r-- | src/test/test_config.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/test/fuzz/fuzzing_common.c b/src/test/fuzz/fuzzing_common.c index 6d0f9d7d60..1285d94aee 100644 --- a/src/test/fuzz/fuzzing_common.c +++ b/src/test/fuzz/fuzzing_common.c @@ -111,7 +111,7 @@ global_init(void) } /* set up the options. */ - mock_options = tor_malloc_zero(sizeof(or_options_t)); + mock_options = options_new(); MOCK(get_options, mock_get_options); /* Make BUG() and nonfatal asserts crash */ diff --git a/src/test/test_config.c b/src/test/test_config.c index a415ca4480..cfca3149f6 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -1762,7 +1762,7 @@ test_config_adding_dir_servers(void *arg) (void)arg; /* allocate options */ - or_options_t *options = tor_malloc_zero(sizeof(or_options_t)); + or_options_t *options = options_new(); /* Allocate and populate configuration lines: * @@ -3533,7 +3533,7 @@ test_config_default_dir_servers(void *arg) int fallback_count = 0; /* new set of options should stop fallback parsing */ - opts = tor_malloc_zero(sizeof(or_options_t)); + opts = options_new(); opts->UseDefaultFallbackDirs = 0; /* set old_options to NULL to force dir update */ consider_adding_dir_servers(opts, NULL); @@ -3547,7 +3547,7 @@ test_config_default_dir_servers(void *arg) /* if we disable the default fallbacks, there must not be any extra */ tt_assert(fallback_count == trusted_count); - opts = tor_malloc_zero(sizeof(or_options_t)); + opts = options_new(); opts->UseDefaultFallbackDirs = 1; consider_adding_dir_servers(opts, opts); trusted_count = smartlist_len(router_get_trusted_dir_servers()); @@ -3607,7 +3607,7 @@ test_config_directory_fetch(void *arg) (void)arg; /* Test Setup */ - or_options_t *options = tor_malloc_zero(sizeof(or_options_t)); + or_options_t *options = options_new(); routerinfo_t routerinfo; memset(&routerinfo, 0, sizeof(routerinfo)); mock_router_pick_published_address_result = -1; |