mirror of
https://github.com/curl/curl.git
synced 2026-08-25 09:23:31 +03:00
Revert "uint-bset: add slot0 member"
This reverts commit 743096a496.
Closes #22581
This commit is contained in:
parent
554efab7f6
commit
6e9880366f
3 changed files with 6 additions and 21 deletions
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@
|
|||
|
||||
struct uint32_bset {
|
||||
uint64_t *slots;
|
||||
uint64_t slot0;
|
||||
uint32_t nslots;
|
||||
uint32_t first_slot_used;
|
||||
#ifdef DEBUGBUILD
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue