From 59cf430400aeee1be1a8583edc02fb232b747e21 Mon Sep 17 00:00:00 2001 From: hugo303 Date: Fri, 30 Jan 2009 11:46:36 +0000 Subject: [PATCH] * Removed unnecessary setting of fork status from srunner_run_unchecked_teardown(). Folded common logic for both teardown functions into a common function. git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@525 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- src/check_run.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/check_run.c b/src/check_run.c index 259e4f3..484ebc0 100644 --- a/src/check_run.c +++ b/src/check_run.c @@ -59,7 +59,8 @@ static void srunner_iterate_tcase_tfuns (SRunner *sr, TCase *tc); static void srunner_add_failure (SRunner *sr, TestResult *tf); static int srunner_run_unchecked_setup (SRunner *sr, TCase *tc); static TestResult * tcase_run_checked_setup (SRunner *sr, TCase *tc); -static void srunner_run_unchecked_teardown (SRunner *sr, TCase *tc); +static void srunner_run_teardown (List *l); +static void srunner_run_unchecked_teardown (TCase *tc); static void tcase_run_checked_teardown (TCase *tc); static void srunner_run_tcase (SRunner *sr, TCase *tc); static TestResult *tcase_run_tfun_nofork (SRunner *sr, TCase *tc, TF *tf, int i); @@ -255,43 +256,32 @@ static TestResult * tcase_run_checked_setup (SRunner *sr, TCase *tc) return tr; } -static void srunner_run_unchecked_teardown (SRunner *sr, TCase *tc) +static void srunner_run_teardown (List *l) { - List *l; Fixture *f; - set_fork_status(CK_NOFORK); - l = tc->unch_tflst; - for (list_front(l); !list_at_end(l); list_advance(l)) { - f = list_val(l); send_ctx_info(CK_CTX_TEARDOWN); f->fun (); } - set_fork_status(srunner_fork_status(sr)); } -static void tcase_run_checked_teardown (TCase *tc) +static void srunner_run_unchecked_teardown (TCase *tc) { - List *l; - Fixture *f; - - l = tc->ch_tflst; - - send_ctx_info(CK_CTX_TEARDOWN); + srunner_run_teardown(tc->unch_tflst); +} - for (list_front(l); !list_at_end(l); list_advance(l)) { - f = list_val(l); - f->fun(); - } +static void tcase_run_checked_teardown (TCase *tc) +{ + srunner_run_teardown(tc->ch_tflst); } static void srunner_run_tcase (SRunner *sr, TCase *tc) { if (srunner_run_unchecked_setup(sr,tc)) { srunner_iterate_tcase_tfuns(sr,tc); - srunner_run_unchecked_teardown(sr, tc); + srunner_run_unchecked_teardown(tc); } } -- 2.40.0