From 426b6cdba9f0584addcf032c4294815b9d737737 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 27 Jan 2021 16:41:00 +0100 Subject: libtest: Use dependency injection This helps static analyzers. --- cpukit/libtest/t-test.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'cpukit/libtest') diff --git a/cpukit/libtest/t-test.c b/cpukit/libtest/t-test.c index 26521728f4..0f19f22c31 100644 --- a/cpukit/libtest/t-test.c +++ b/cpukit/libtest/t-test.c @@ -1002,6 +1002,8 @@ T_check_steps(unsigned int planned_steps, unsigned int steps, } } +static void T_do_pop_fixture(T_context *); + static void T_do_case_end(T_context *ctx, const T_case_context *tc) { @@ -1013,7 +1015,7 @@ T_do_case_end(T_context *ctx, const T_case_context *tc) T_time_string ts; while (ctx->fixtures != NULL) { - T_pop_fixture(); + T_do_pop_fixture(ctx); } T_call_destructors(ctx); @@ -1237,15 +1239,13 @@ T_push_fixture(T_fixture_node *node, const T_fixture *fixture) return context; } -void -T_pop_fixture(void) +static void +T_do_pop_fixture(T_context *ctx) { - T_context *ctx; T_fixture_node *node; const T_fixture *fixture; T_fixture_node *next; - ctx = &T_instance; node = ctx->fixtures; next = node->next; ctx->fixtures = next; @@ -1274,6 +1274,12 @@ T_pop_fixture(void) memset(node, 0, sizeof(*node)); } +void +T_pop_fixture(void) +{ + T_do_pop_fixture(&T_instance); +} + size_t T_get_scope(const char * const * const *desc, char *buf, size_t n, const size_t *second_indices) -- cgit v1.2.3