From b419e7ae0c9869ac3eb06d529efeb2c6dc1b4bc1 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 12 May 2015 09:46:53 +0200 Subject: 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. --- tests/unit/unit1305.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'tests/unit/unit1305.c') 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, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , 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; -- cgit v1.2.3