changeset 18872:e7c896eff939

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@dovecot.fi>
author Phil Carmody <phil@dovecot.fi>
date Wed, 17 Jun 2015 11:42:53 +0300
parents 69b231fdf5d7
children 21c0ffec1d2b
files src/lib/test-data-stack.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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
 }