hash: lazy-alloc the table in Curl_hash_add()

This makes Curl_hash_init() infallible which saves error paths.

Closes #8132
This commit is contained in:
Daniel Stenberg 2021-12-10 12:54:17 +01:00
parent e43ad4b474
commit 254f7bd78a
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
10 changed files with 78 additions and 83 deletions

View file

@ -977,12 +977,12 @@ static void freednsentry(void *freethis)
}
/*
* Curl_mk_dnscache() inits a new DNS cache and returns success/failure.
* Curl_init_dnscache() inits a new DNS cache.
*/
int Curl_mk_dnscache(struct Curl_hash *hash)
void Curl_init_dnscache(struct Curl_hash *hash)
{
return Curl_hash_init(hash, 7, Curl_hash_str, Curl_str_key_compare,
freednsentry);
Curl_hash_init(hash, 7, Curl_hash_str, Curl_str_key_compare,
freednsentry);
}
/*