dovecot-2.2: lib: data-stack - simplify expressions in data_stac...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jul 28 13:54:27 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/3e7dbf85d034
changeset: 17640:3e7dbf85d034
user:      Phil Carmody <phil at dovecot.fi>
date:      Mon Jul 28 16:45:33 2014 +0300
description:
lib: data-stack - simplify expressions in data_stack_last_buffer_reset
Noisy expression used more than once, give it a meaningful name.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/lib/data-stack.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (31 lines):

diff -r b4eec0a20bba -r 3e7dbf85d034 src/lib/data-stack.c
--- a/src/lib/data-stack.c	Mon Jul 28 16:45:33 2014 +0300
+++ b/src/lib/data-stack.c	Mon Jul 28 16:45:33 2014 +0300
@@ -93,12 +93,13 @@
 {
 	if (last_buffer_block != NULL) {
 #ifdef DEBUG
-		unsigned char *p;
+		unsigned char *last_alloc_end, *p;
 		unsigned int i;
 
-		p = STACK_BLOCK_DATA(current_block) +
-			(current_block->size - current_block->left) +
-			MEM_ALIGN(sizeof(size_t)) + MEM_ALIGN(last_buffer_size);
+		last_alloc_end = STACK_BLOCK_DATA(current_block) +
+			(current_block->size - current_block->left);
+		p = last_alloc_end + MEM_ALIGN(sizeof(size_t)) + MEM_ALIGN(last_buffer_size);
+
 #endif
 		/* reset t_buffer_get() mark - not really needed but makes it
 		   easier to notice if t_malloc()/t_push()/t_pop() is called
@@ -114,8 +115,7 @@
 		}
 
 		if (!preserve_data) {
-			p = STACK_BLOCK_DATA(current_block) +
-				(current_block->size - current_block->left);
+			p = last_alloc_end;
 			memset(p, CLEAR_CHR, SENTRY_COUNT);
 		}
 #endif


More information about the dovecot-cvs mailing list