mirror of
https://github.com/curl/curl.git
synced 2026-08-25 22:03:47 +03:00
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:
parent
65f8253336
commit
e80c893254
5 changed files with 60 additions and 29 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue