lib: add meta_hash to connection, eliminate hash_offt

With a meta_hash at each connection (similar to easy handle, let
multi_ev.c store its pollsets as meta data, no longer needing its own
hashes.

This eliminates the last use of Curl_hash_offt. Remove it.

Closes #17095
This commit is contained in:
Stefan Eissing 2025-04-18 11:03:29 +02:00 committed by Daniel Stenberg
parent 1d66a769d7
commit 657aae79c0
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
18 changed files with 126 additions and 343 deletions

View file

@ -149,40 +149,3 @@ Called repeatedly, it iterates over all the entries in the hash table.
Note: it only guarantees functionality if the hash table remains untouched
during its iteration.
# `curl_off_t` dedicated hash functions
## `Curl_hash_offt_init`
~~~c
void Curl_hash_offt_init(struct Curl_hash *h,
size_t slots,
Curl_hash_dtor dtor);
~~~
Initializes a hash table for `curl_off_t` values. Pass in desired number of
`slots` and `dtor` function.
## `Curl_hash_offt_set`
~~~c
void *Curl_hash_offt_set(struct Curl_hash *h, curl_off_t id, void *elem);
~~~
Associate a custom `elem` pointer with the given `id`.
## `Curl_hash_offt_remove`
~~~c
int Curl_hash_offt_remove(struct Curl_hash *h, curl_off_t id);
~~~
Remove the `id` from the hash.
## `Curl_hash_offt_get`
~~~c
void *Curl_hash_offt_get(struct Curl_hash *h, curl_off_t id);
~~~
Get the pointer associated with the specified `id`.

View file

@ -126,6 +126,3 @@ Iterating a sparse bitset works the same as for bitset and table.
At last, there are places in libcurl such as the HTTP/2 and HTTP/3 protocol implementations that need
to store their own data related to a transfer. `uint_hash` allows then to associate an unsigned int,
e.g. the transfer's `mid`, to their own data.
This is just a variation of `hash_offt` that can associate data with a `connection_id`. Which
is a specialization of the generic `Curl_hash`.