]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: test-data-stack - simplify #if-ing out of DEBUG-only fatal test
authorPhil Carmody <phil@dovecot.fi>
Wed, 17 Jun 2015 08:42:53 +0000 (11:42 +0300)
committerPhil Carmody <phil@dovecot.fi>
Wed, 17 Jun 2015 08:42:53 +0000 (11:42 +0300)
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>
src/lib/test-data-stack.c

index 0064c537958f7fb7faf94899b5c290c4d5ffbf4f..e84d93c4e971d0748b741e1cfdbf9f2e50e8f7f9 100644 (file)
@@ -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
 }