]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
data-stack: t_push should always keep track of the marker
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Wed, 19 Oct 2016 16:24:12 +0000 (12:24 -0400)
committerGitLab <gitlab@git.dovecot.net>
Wed, 2 Nov 2016 21:21:59 +0000 (23:21 +0200)
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.

src/lib/data-stack.c
src/lib/data-stack.h

index 2fc085484608b7ef014b1880e53bbb61d253cf40..913326d21878b097e8814b10e3ad9e12a5ab1da0 100644 (file)
@@ -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
index 765c5d83001596609d1e1e2486181f5737d4746c..5ea1237ae65e4c45dafa70ac62896c640756d224 100644 (file)
@@ -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))) \