Revert "uint-bset: add slot0 member"

This reverts commit 743096a496.

Closes #22581
This commit is contained in:
Stefan Eissing 2026-08-14 11:40:24 +02:00 committed by Daniel Stenberg
parent 554efab7f6
commit 6e9880366f
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 6 additions and 21 deletions

View file

@ -44,22 +44,14 @@ CURLcode Curl_uint32_bset_resize(struct uint32_bset *bset, uint32_t nmax)
DEBUGASSERT(bset->init == CURL_UINT32_BSET_MAGIC);
if(nslots != bset->nslots) {
uint64_t *slots;
if(nslots > 1) {
slots = curlx_calloc(nslots, sizeof(uint64_t));
if(!slots)
return CURLE_OUT_OF_MEMORY;
}
else {
bset->slot0 = 0;
slots = &bset->slot0;
}
uint64_t *slots = curlx_calloc(nslots, sizeof(uint64_t));
if(!slots)
return CURLE_OUT_OF_MEMORY;
if((bset->slots != slots) && nslots && bset->nslots) {
if(bset->slots) {
memcpy(slots, bset->slots,
(CURLMIN(nslots, bset->nslots) * sizeof(uint64_t)));
if(bset->slots != &bset->slot0)
curlx_free(bset->slots);
curlx_free(bset->slots);
}
bset->slots = slots;
bset->nslots = nslots;
@ -71,8 +63,7 @@ CURLcode Curl_uint32_bset_resize(struct uint32_bset *bset, uint32_t nmax)
void Curl_uint32_bset_destroy(struct uint32_bset *bset)
{
DEBUGASSERT(bset->init == CURL_UINT32_BSET_MAGIC);
if(bset->slots != &bset->slot0)
curlx_free(bset->slots);
curlx_free(bset->slots);
memset(bset, 0, sizeof(*bset));
}

View file

@ -39,7 +39,6 @@
struct uint32_bset {
uint64_t *slots;
uint64_t slot0;
uint32_t nslots;
uint32_t first_slot_used;
#ifdef DEBUGBUILD