From 51f4115b7d444a9ec14dbcb3bafa9569f6f68160 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Thu, 13 Apr 2017 22:44:52 +0200 Subject: [PATCH] Rewrite the test to make it cleaner for static analysis. --- tests/test-mshared.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test-mshared.c b/tests/test-mshared.c index 16a2976e..25bc1e27 100644 --- a/tests/test-mshared.c +++ b/tests/test-mshared.c @@ -16,8 +16,12 @@ static int f(const shared_int_t p) int main(void) { shared_int_t p1, p2; + + int *p = malloc(sizeof(int)); + assert (p != NULL); - shared_int_init2(p1, M_ASSIGN_CAST(int*, malloc(sizeof(int)))); + shared_int_init2(p1, p); + assert(!shared_int_NULL_p(p1)); assert(shared_int_ref(p1) != NULL); *shared_int_ref(p1) = 12;