From: Josef 'Jeff' Sipek Date: Wed, 19 Oct 2016 16:24:12 +0000 (-0400) Subject: data-stack: t_push should always keep track of the marker X-Git-Tag: 2.3.0.rc1~2688 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ccfe24c9fa6bea4298dce6bc2d4cc65f05b8a538;p=thirdparty%2Fdovecot%2Fcore.git data-stack: t_push should always keep track of the marker Instead of only keeping track of it on DEBUG builds, t_push should always keep the marker around. This will help diagnosing issues on non-debug builds. --- diff --git a/src/lib/data-stack.c b/src/lib/data-stack.c index 2fc0854846..913326d218 100644 --- a/src/lib/data-stack.c +++ b/src/lib/data-stack.c @@ -59,8 +59,8 @@ struct stack_frame_block { struct stack_block *block[BLOCK_FRAME_COUNT]; size_t block_space_used[BLOCK_FRAME_COUNT]; size_t last_alloc_size[BLOCK_FRAME_COUNT]; -#ifdef DEBUG const char *marker[BLOCK_FRAME_COUNT]; +#ifdef DEBUG /* Fairly arbitrary profiling data */ unsigned long long alloc_bytes[BLOCK_FRAME_COUNT]; unsigned int alloc_count[BLOCK_FRAME_COUNT]; @@ -176,12 +176,10 @@ data_stack_frame_t t_push(const char *marker) current_frame_block->block[frame_pos] = current_block; current_frame_block->block_space_used[frame_pos] = current_block->left; current_frame_block->last_alloc_size[frame_pos] = 0; -#ifdef DEBUG current_frame_block->marker[frame_pos] = marker; +#ifdef DEBUG current_frame_block->alloc_bytes[frame_pos] = 0ULL; current_frame_block->alloc_count[frame_pos] = 0; -#else - (void)marker; /* only used for debugging */ #endif #ifndef STATIC_CHECKER diff --git a/src/lib/data-stack.h b/src/lib/data-stack.h index 765c5d8300..5ea1237ae6 100644 --- a/src/lib/data-stack.h +++ b/src/lib/data-stack.h @@ -58,13 +58,9 @@ bool t_pop(data_stack_frame_t *id) ATTR_HOT; void t_pop_last_unsafe(void); /* Usage: T_BEGIN { code } T_END */ -#ifndef DEBUG #define T_BEGIN \ - STMT_START { data_stack_frame_t _data_stack_cur_id = t_push(NULL); -#else -#define T_BEGIN \ - STMT_START { data_stack_frame_t _data_stack_cur_id = t_push(__func__); -#endif + STMT_START { \ + data_stack_frame_t _data_stack_cur_id = t_push(__func__); #define T_END \ STMT_START { \ if (unlikely(!t_pop(&_data_stack_cur_id))) \