multi: xfer table/bitset, handle limits

* calculate capacity growth on multi's xfer table and bitsets to
  work correctly when approaching UINT_MAX
* uint-bset: track the first 64bit slot used. This avoids slot scans
  on empty sets.
* uint-tbl: remove restriction to grow ot UINT_MAX, it is multi's
  job to enforce limits suitable for its use
* test751: use curl_mfprintf() for error messages

Closes #17731
This commit is contained in:
Stefan Eissing 2025-06-24 12:57:04 +02:00 committed by Daniel Stenberg
parent 65f8253336
commit e80c893254
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 60 additions and 29 deletions

View file

@ -68,7 +68,7 @@ CURLcode Curl_uint_tbl_resize(struct uint_tbl *tbl, unsigned int nrows)
{
/* we use `tbl->nrows + 1` during iteration, want that to work */
DEBUGASSERT(tbl->init == CURL_UINT_TBL_MAGIC);
if(!nrows || (nrows == UINT_MAX))
if(!nrows)
return CURLE_BAD_FUNCTION_ARGUMENT;
if(nrows != tbl->nrows) {
void **rows = calloc(nrows, sizeof(void *));
@ -130,7 +130,7 @@ bool Curl_uint_tbl_add(struct uint_tbl *tbl, void *entry, unsigned int *pkey)
DEBUGASSERT(tbl->init == CURL_UINT_TBL_MAGIC);
if(!entry || !pkey)
return FALSE;
*pkey = UINT_MAX; /* always invalid */
*pkey = UINT_MAX;
if(tbl->nentries == tbl->nrows) /* full */
return FALSE;