Loading lib/hash.c +0 −37 Original line number Diff line number Diff line Loading @@ -89,32 +89,6 @@ Curl_hash_init(struct curl_hash *h, } } struct curl_hash * Curl_hash_alloc(int slots, hash_function hfunc, comp_function comparator, curl_hash_dtor dtor) { struct curl_hash *h; if(!slots || !hfunc || !comparator ||!dtor) { return NULL; /* failure */ } h = malloc(sizeof(struct curl_hash)); if(h) { if(Curl_hash_init(h, slots, hfunc, comparator, dtor)) { /* failure */ free(h); h = NULL; } } return h; } static struct curl_hash_element * mk_hash_element(const void *key, size_t key_len, const void *p) { Loading Loading @@ -281,17 +255,6 @@ Curl_hash_clean_with_criterium(struct curl_hash *h, void *user, } } void Curl_hash_destroy(struct curl_hash *h) { if(!h) return; Curl_hash_clean(h); free(h); } size_t Curl_hash_str(void* key, size_t key_length, size_t slots_num) { const char* key_str = (const char *) key; Loading lib/hash.h +1 −8 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2007, 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 Loading Loading @@ -74,11 +74,6 @@ int Curl_hash_init(struct curl_hash *h, comp_function comparator, curl_hash_dtor dtor); struct curl_hash *Curl_hash_alloc(int slots, hash_function hfunc, comp_function comparator, curl_hash_dtor dtor); void *Curl_hash_add(struct curl_hash *h, void *key, size_t key_len, void *p); int Curl_hash_delete(struct curl_hash *h, void *key, size_t key_len); void *Curl_hash_pick(struct curl_hash *, void * key, size_t key_len); Loading @@ -88,8 +83,6 @@ int Curl_hash_count(struct curl_hash *h); void Curl_hash_clean(struct curl_hash *h); void Curl_hash_clean_with_criterium(struct curl_hash *h, void *user, int (*comp)(void *, void *)); void Curl_hash_destroy(struct curl_hash *h); size_t Curl_hash_str(void* key, size_t key_length, size_t slots_num); size_t Curl_str_key_compare(void*k1, size_t key1_len, void*k2, size_t key2_len); Loading lib/hostip.c +4 −3 Original line number Diff line number Diff line Loading @@ -742,11 +742,12 @@ static void freednsentry(void *freethis) } /* * Curl_mk_dnscache() creates a new DNS cache and returns the handle for it. * Curl_mk_dnscache() inits a new DNS cache and returns success/failure. */ struct curl_hash *Curl_mk_dnscache(void) int Curl_mk_dnscache(struct curl_hash *hash) { return Curl_hash_alloc(7, Curl_hash_str, Curl_str_key_compare, freednsentry); return Curl_hash_init(hash, 7, Curl_hash_str, Curl_str_key_compare, freednsentry); } /* Loading lib/hostip.h +2 −2 Original line number Diff line number Diff line Loading @@ -124,8 +124,8 @@ void Curl_resolv_unlock(struct SessionHandle *data, /* for debugging purposes only: */ void Curl_scan_cache_used(void *user, void *ptr); /* make a new dns cache and return the handle */ struct curl_hash *Curl_mk_dnscache(void); /* init a new dns cache and return success */ int Curl_mk_dnscache(struct curl_hash *hash); /* prune old entries from the DNS cache */ void Curl_hostcache_prune(struct SessionHandle *data); Loading lib/multi.c +5 −7 Original line number Diff line number Diff line Loading @@ -294,8 +294,7 @@ struct Curl_multi *Curl_multi_handle(int hashsize, /* socket hash */ multi->type = CURL_MULTI_HANDLE; multi->hostcache = Curl_mk_dnscache(); if(!multi->hostcache) if(Curl_mk_dnscache(&multi->hostcache)) goto error; if(sh_init(&multi->sockhash, hashsize)) Loading Loading @@ -329,8 +328,7 @@ struct Curl_multi *Curl_multi_handle(int hashsize, /* socket hash */ error: Curl_hash_clean(&multi->sockhash); Curl_hash_destroy(multi->hostcache); multi->hostcache = NULL; Curl_hash_clean(&multi->hostcache); Curl_conncache_destroy(&multi->conn_cache); Curl_close(multi->closure_handle); multi->closure_handle = NULL; Loading Loading @@ -400,7 +398,7 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle, easy handle's one is currently not set. */ else if(!data->dns.hostcache || (data->dns.hostcachetype == HCACHE_NONE)) { data->dns.hostcache = multi->hostcache; data->dns.hostcache = &multi->hostcache; data->dns.hostcachetype = HCACHE_MULTI; } Loading Loading @@ -1861,7 +1859,7 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle) sigpipe_ignore(multi->closure_handle, &pipe_st); restore_pipe = TRUE; multi->closure_handle->dns.hostcache = multi->hostcache; multi->closure_handle->dns.hostcache = &multi->hostcache; Curl_hostcache_clean(multi->closure_handle, multi->closure_handle->dns.hostcache); Loading Loading @@ -1891,7 +1889,7 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle) data = nextdata; } Curl_hash_destroy(multi->hostcache); Curl_hash_clean(&multi->hostcache); /* Free the blacklists by setting them to NULL */ Curl_pipeline_set_site_blacklist(NULL, &multi->pipelining_site_bl); Loading Loading
lib/hash.c +0 −37 Original line number Diff line number Diff line Loading @@ -89,32 +89,6 @@ Curl_hash_init(struct curl_hash *h, } } struct curl_hash * Curl_hash_alloc(int slots, hash_function hfunc, comp_function comparator, curl_hash_dtor dtor) { struct curl_hash *h; if(!slots || !hfunc || !comparator ||!dtor) { return NULL; /* failure */ } h = malloc(sizeof(struct curl_hash)); if(h) { if(Curl_hash_init(h, slots, hfunc, comparator, dtor)) { /* failure */ free(h); h = NULL; } } return h; } static struct curl_hash_element * mk_hash_element(const void *key, size_t key_len, const void *p) { Loading Loading @@ -281,17 +255,6 @@ Curl_hash_clean_with_criterium(struct curl_hash *h, void *user, } } void Curl_hash_destroy(struct curl_hash *h) { if(!h) return; Curl_hash_clean(h); free(h); } size_t Curl_hash_str(void* key, size_t key_length, size_t slots_num) { const char* key_str = (const char *) key; Loading
lib/hash.h +1 −8 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2007, 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 Loading Loading @@ -74,11 +74,6 @@ int Curl_hash_init(struct curl_hash *h, comp_function comparator, curl_hash_dtor dtor); struct curl_hash *Curl_hash_alloc(int slots, hash_function hfunc, comp_function comparator, curl_hash_dtor dtor); void *Curl_hash_add(struct curl_hash *h, void *key, size_t key_len, void *p); int Curl_hash_delete(struct curl_hash *h, void *key, size_t key_len); void *Curl_hash_pick(struct curl_hash *, void * key, size_t key_len); Loading @@ -88,8 +83,6 @@ int Curl_hash_count(struct curl_hash *h); void Curl_hash_clean(struct curl_hash *h); void Curl_hash_clean_with_criterium(struct curl_hash *h, void *user, int (*comp)(void *, void *)); void Curl_hash_destroy(struct curl_hash *h); size_t Curl_hash_str(void* key, size_t key_length, size_t slots_num); size_t Curl_str_key_compare(void*k1, size_t key1_len, void*k2, size_t key2_len); Loading
lib/hostip.c +4 −3 Original line number Diff line number Diff line Loading @@ -742,11 +742,12 @@ static void freednsentry(void *freethis) } /* * Curl_mk_dnscache() creates a new DNS cache and returns the handle for it. * Curl_mk_dnscache() inits a new DNS cache and returns success/failure. */ struct curl_hash *Curl_mk_dnscache(void) int Curl_mk_dnscache(struct curl_hash *hash) { return Curl_hash_alloc(7, Curl_hash_str, Curl_str_key_compare, freednsentry); return Curl_hash_init(hash, 7, Curl_hash_str, Curl_str_key_compare, freednsentry); } /* Loading
lib/hostip.h +2 −2 Original line number Diff line number Diff line Loading @@ -124,8 +124,8 @@ void Curl_resolv_unlock(struct SessionHandle *data, /* for debugging purposes only: */ void Curl_scan_cache_used(void *user, void *ptr); /* make a new dns cache and return the handle */ struct curl_hash *Curl_mk_dnscache(void); /* init a new dns cache and return success */ int Curl_mk_dnscache(struct curl_hash *hash); /* prune old entries from the DNS cache */ void Curl_hostcache_prune(struct SessionHandle *data); Loading
lib/multi.c +5 −7 Original line number Diff line number Diff line Loading @@ -294,8 +294,7 @@ struct Curl_multi *Curl_multi_handle(int hashsize, /* socket hash */ multi->type = CURL_MULTI_HANDLE; multi->hostcache = Curl_mk_dnscache(); if(!multi->hostcache) if(Curl_mk_dnscache(&multi->hostcache)) goto error; if(sh_init(&multi->sockhash, hashsize)) Loading Loading @@ -329,8 +328,7 @@ struct Curl_multi *Curl_multi_handle(int hashsize, /* socket hash */ error: Curl_hash_clean(&multi->sockhash); Curl_hash_destroy(multi->hostcache); multi->hostcache = NULL; Curl_hash_clean(&multi->hostcache); Curl_conncache_destroy(&multi->conn_cache); Curl_close(multi->closure_handle); multi->closure_handle = NULL; Loading Loading @@ -400,7 +398,7 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle, easy handle's one is currently not set. */ else if(!data->dns.hostcache || (data->dns.hostcachetype == HCACHE_NONE)) { data->dns.hostcache = multi->hostcache; data->dns.hostcache = &multi->hostcache; data->dns.hostcachetype = HCACHE_MULTI; } Loading Loading @@ -1861,7 +1859,7 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle) sigpipe_ignore(multi->closure_handle, &pipe_st); restore_pipe = TRUE; multi->closure_handle->dns.hostcache = multi->hostcache; multi->closure_handle->dns.hostcache = &multi->hostcache; Curl_hostcache_clean(multi->closure_handle, multi->closure_handle->dns.hostcache); Loading Loading @@ -1891,7 +1889,7 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle) data = nextdata; } Curl_hash_destroy(multi->hostcache); Curl_hash_clean(&multi->hostcache); /* Free the blacklists by setting them to NULL */ Curl_pipeline_set_site_blacklist(NULL, &multi->pipelining_site_bl); Loading