From: Phil Carmody Date: Wed, 17 Jun 2015 08:42:53 +0000 (+0300) Subject: lib: test-data-stack - simplify #if-ing out of DEBUG-only fatal test X-Git-Tag: 2.2.19.rc1~322 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03e0be24656823c795dfadccf68bbeeefa6fb772;p=thirdparty%2Fdovecot%2Fcore.git 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 --- diff --git a/src/lib/test-data-stack.c b/src/lib/test-data-stack.c index 0064c53795..e84d93c4e9 100644 --- a/src/lib/test-data-stack.c +++ b/src/lib/test-data-stack.c @@ -148,6 +148,7 @@ void test_data_stack(void) 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 @@ enum fatal_test_state fatal_data_stack(int stage) } switch(stage) { -#ifdef DEBUG case 0: { unsigned char *p; test_begin("fatal data-stack underrun"); @@ -223,9 +223,11 @@ enum fatal_test_state fatal_data_stack(int stage) 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 }