dovecot-2.2: lib: test-data-stack - simplify #if-ing out of DEBU...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 17 08:45:56 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/e7c896eff939
changeset: 18872:e7c896eff939
user:      Phil Carmody <phil at dovecot.fi>
date:      Wed Jun 17 11:42:53 2015 +0300
description:
lib: test-data-stack - simplify #if-ing out of DEBUG-only fatal test
With no canaries, nothing can be tested, so just reduce this to a trivial
1-line return on the non-DEBUG case.

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

diffstat:

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

diffs (32 lines):

diff -r 69b231fdf5d7 -r e7c896eff939 src/lib/test-data-stack.c
--- a/src/lib/test-data-stack.c	Wed Jun 17 11:42:30 2015 +0300
+++ b/src/lib/test-data-stack.c	Wed Jun 17 11:42:53 2015 +0300
@@ -148,6 +148,7 @@
 
 enum fatal_test_state fatal_data_stack(int stage)
 {
+#ifdef DEBUG
 	/* If we abort, then we'll be left with a dangling t_push()
 	   keep a record of our temporary stack id, so we can clean up. */
 	static unsigned int t_id = 999999999;
@@ -172,7 +173,6 @@
 	}
 
 	switch(stage) {
-#ifdef DEBUG
 	case 0: {
 		unsigned char *p;
 		test_begin("fatal data-stack underrun");
@@ -223,9 +223,11 @@
 		return FATAL_TEST_FAILURE;
 	}
 
-#endif
 	default:
 		things_are_messed_up = TRUE;
 		return FATAL_TEST_FINISHED;
 	}
+#else
+	return stage == 0 ? FATAL_TEST_FINISHED : FATAL_TEST_ABORT;
+#endif
 }


More information about the dovecot-cvs mailing list