mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:31:41 +03:00
hash_offt: standalone hash for curl_off_t
Add a standalong hash table for curl_offt_t as key. This allows a smaller memory footprint and faster lookups as we do not need to deal with variable key lengths. Use in all places we had the standard hash for this purpose. Closes #16442
This commit is contained in:
parent
2809723ddf
commit
1aa69221be
14 changed files with 392 additions and 110 deletions
22
lib/hash.c
22
lib/hash.c
|
|
@ -400,25 +400,3 @@ Curl_hash_next_element(struct Curl_hash_iterator *iter)
|
|||
|
||||
return iter->current;
|
||||
}
|
||||
|
||||
void Curl_hash_offt_init(struct Curl_hash *h,
|
||||
size_t slots,
|
||||
Curl_hash_dtor dtor)
|
||||
{
|
||||
Curl_hash_init(h, slots, Curl_hash_str, Curl_str_key_compare, dtor);
|
||||
}
|
||||
|
||||
void *Curl_hash_offt_set(struct Curl_hash *h, curl_off_t id, void *elem)
|
||||
{
|
||||
return Curl_hash_add(h, &id, sizeof(id), elem);
|
||||
}
|
||||
|
||||
int Curl_hash_offt_remove(struct Curl_hash *h, curl_off_t id)
|
||||
{
|
||||
return Curl_hash_delete(h, &id, sizeof(id));
|
||||
}
|
||||
|
||||
void *Curl_hash_offt_get(struct Curl_hash *h, curl_off_t id)
|
||||
{
|
||||
return Curl_hash_pick(h, &id, sizeof(id));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue