From: Timo Sirainen Date: Wed, 31 Mar 2021 09:51:34 +0000 (+0300) Subject: lib: data-stack - mem_block_alloc() - Set stack_block.left to final value immediately X-Git-Tag: 2.3.16~253 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7b1c81b369dda0f1c84268d299d1f5ffd17c1050;p=thirdparty%2Fdovecot%2Fcore.git lib: data-stack - mem_block_alloc() - Set stack_block.left to final value immediately There's no need to first set it to 0 and then have the caller change it again. --- diff --git a/src/lib/data-stack.c b/src/lib/data-stack.c index a1bd6bccfb..895a6950f4 100644 --- a/src/lib/data-stack.c +++ b/src/lib/data-stack.c @@ -354,7 +354,7 @@ static struct stack_block *mem_block_alloc(size_t min_size) alloc_size + SIZEOF_MEMBLOCK); } block->size = alloc_size; - block->left = 0; + block->left = block->size; block->left_lowwater = block->size; block->next = NULL; block->canary = BLOCK_CANARY; @@ -406,7 +406,6 @@ static void *t_malloc_real(size_t size, bool permanent) warn = TRUE; #endif - block->left = block->size; block->next = NULL; current_block->next = block; current_block = block; @@ -600,7 +599,6 @@ void data_stack_init(void) outofmem_area.block.canary = BLOCK_CANARY; current_block = mem_block_alloc(INITIAL_STACK_SIZE); - current_block->left = current_block->size; current_block->next = NULL; current_frame_block = NULL;