bugfixed: array_allocator_alloc MUST init the array
parent
1969fbba8d
commit
fafbbb557e
3
HISTORY
3
HISTORY
|
|
@ -1,4 +1,7 @@
|
|||
|
||||
Version 1.69 2023-08-02
|
||||
* bugfixed: array_allocator_alloc MUST init the array
|
||||
|
||||
Version 1.68 2023-07-05
|
||||
* sorted_queue.[hc]: pop_compare_func support argument
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ VoidArray *array_allocator_alloc(ArrayAllocatorContext *ctx,
|
|||
{
|
||||
int alloc;
|
||||
int bytes;
|
||||
VoidArray *array;
|
||||
|
||||
if (target_count <= ctx->min_count) {
|
||||
alloc = ctx->min_count;
|
||||
|
|
@ -71,7 +72,11 @@ VoidArray *array_allocator_alloc(ArrayAllocatorContext *ctx,
|
|||
}
|
||||
|
||||
bytes = sizeof(VoidArray) + alloc * ctx->element_size;
|
||||
return (VoidArray *)fast_allocator_alloc(&ctx->allocator, bytes);
|
||||
if ((array=fast_allocator_alloc(&ctx->allocator, bytes)) != NULL) {
|
||||
array->alloc = alloc;
|
||||
array->count = 0;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
VoidArray *array_allocator_realloc(ArrayAllocatorContext *ctx,
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ extern "C" {
|
|||
static inline void array_allocator_free(ArrayAllocatorContext *ctx,
|
||||
VoidArray *array)
|
||||
{
|
||||
array->count = 0;
|
||||
fast_allocator_free(&ctx->allocator, array);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1163,6 +1163,7 @@ OUTER:
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
{
|
||||
bool old_need_lock;
|
||||
old_need_lock = mblock->need_lock;
|
||||
|
|
@ -1173,6 +1174,7 @@ OUTER:
|
|||
mblock, *reclaim_count, fast_mblock_free_count(mblock));
|
||||
mblock->need_lock = old_need_lock;
|
||||
}
|
||||
*/
|
||||
|
||||
*ppFreelist = freelist;
|
||||
return (freelist != NULL ? 0 : ENOENT);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ void sorted_queue_push_ex(struct sorted_queue *sq, void *data, bool *notify)
|
|||
{
|
||||
struct fc_list_head *dlink;
|
||||
struct fc_list_head *current;
|
||||
int count = 0;
|
||||
|
||||
dlink = FC_SORTED_QUEUE_DLINK_PTR(sq, data);
|
||||
PTHREAD_MUTEX_LOCK(&sq->lcp.lock);
|
||||
|
|
@ -70,7 +69,6 @@ void sorted_queue_push_ex(struct sorted_queue *sq, void *data, bool *notify)
|
|||
sq, current)) < 0)
|
||||
{
|
||||
current = current->prev;
|
||||
++count;
|
||||
}
|
||||
fc_list_add_after(dlink, current);
|
||||
*notify = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue