aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2015-05-12 09:46:53 +0200
committerDaniel Stenberg <daniel@haxx.se>2015-05-12 09:46:53 +0200
commitb419e7ae0c9869ac3eb06d529efeb2c6dc1b4bc1 (patch)
tree6938b33aaf767e9006ce881bd707651b10cc946a /tests
parentd37e0160c2eb22c616ae3ff25c03c3b4711b2a13 (diff)
hostcache: made all host caches use structs, not pointers
This avoids unnecessary dynamic allocs and as this also removed the last users of *hash_alloc() and *hash_destroy(), those two functions are now removed.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/unit1305.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/unit/unit1305.c b/tests/unit/unit1305.c
index 4f9c609b0..b4e837762 100644
--- a/tests/unit/unit1305.c
+++ b/tests/unit/unit1305.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -40,18 +40,19 @@
#include "memdebug.h" /* LAST include file */
static struct SessionHandle *data;
-static struct curl_hash *hp;
+static struct curl_hash hp;
static char *data_key;
static struct Curl_dns_entry *data_node;
static CURLcode unit_setup( void )
{
+ int rc;
data = curl_easy_init();
if (!data)
return CURLE_OUT_OF_MEMORY;
- hp = Curl_mk_dnscache();
- if(!hp) {
+ rc = Curl_mk_dnscache(&hp);
+ if(rc) {
curl_easy_cleanup(data);
curl_global_cleanup();
return CURLE_OUT_OF_MEMORY;
@@ -66,7 +67,7 @@ static void unit_stop( void )
free(data_node);
}
free(data_key);
- Curl_hash_destroy(hp);
+ Curl_hash_clean(&hp);
curl_easy_cleanup(data);
curl_global_cleanup();
@@ -129,7 +130,7 @@ UNITTEST_START
key_len = strlen(data_key);
data_node->inuse = 1; /* hash will hold the reference */
- nodep = Curl_hash_add(hp, data_key, key_len+1, data_node);
+ nodep = Curl_hash_add(&hp, data_key, key_len+1, data_node);
abort_unless(nodep, "insertion into hash failed");
/* Freeing will now be done by Curl_hash_destroy */
data_node = NULL;