From ae89bfa145ebcb3d92c9cc96e681974689b17dee Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 5 Oct 2020 13:41:22 +0200 Subject: cmocka: Rename to cast_ptr_to_uintmax_type() --- example/mock/chef_wrap/waiter_test_wrap.c | 4 ++-- include/cmocka.h | 16 ++++++++-------- src/cmocka.c | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/example/mock/chef_wrap/waiter_test_wrap.c b/example/mock/chef_wrap/waiter_test_wrap.c index 04fe721..e9fee7e 100644 --- a/example/mock/chef_wrap/waiter_test_wrap.c +++ b/example/mock/chef_wrap/waiter_test_wrap.c @@ -121,7 +121,7 @@ static void test_order_hotdog(void **state) will_return(__wrap_chef_cook, true); will_return(__wrap_chef_cook, true); /* The result will be a hotdog and the cooking process will succeed */ - will_return(__wrap_chef_cook, cast_ptr_to_largest_integral_type("hotdog")); + will_return(__wrap_chef_cook, cast_ptr_to_uintmax_type("hotdog")); will_return(__wrap_chef_cook, 0); /* Test the waiter */ @@ -154,7 +154,7 @@ static void test_bad_dish(void **state) * We expect the waiter to handle the bad dish and return an error * code */ - will_return(__wrap_chef_cook, cast_ptr_to_largest_integral_type("burger")); + will_return(__wrap_chef_cook, cast_ptr_to_uintmax_type("burger")); will_return(__wrap_chef_cook, 0); /* Test the waiter */ diff --git a/include/cmocka.h b/include/cmocka.h index 532eebc..abdf9ec 100644 --- a/include/cmocka.h +++ b/include/cmocka.h @@ -66,7 +66,7 @@ int __stdcall IsDebuggerPresent(); ((uintptr_t)(value)) /* Perform a cast of a pointer to uintmax_t */ -#define cast_ptr_to_largest_integral_type(value) \ +#define cast_ptr_to_uintmax_type(value) \ cast_to_uintmax_type(cast_to_uintptr_type(value)) /* GCC have printf type attribute check. */ @@ -974,7 +974,7 @@ void check_expected_ptr(#parameter); #else #define check_expected_ptr(parameter) \ _check_expected(__func__, #parameter, __FILE__, __LINE__, \ - cast_ptr_to_largest_integral_type(parameter)) + cast_ptr_to_uintmax_type(parameter)) #endif /** @} */ @@ -1070,7 +1070,7 @@ void assert_return_code(int rc, int error); */ void assert_non_null(void *pointer); #else -#define assert_non_null(c) _assert_true(cast_ptr_to_largest_integral_type(c), #c, \ +#define assert_non_null(c) _assert_true(cast_ptr_to_uintmax_type(c), #c, \ __FILE__, __LINE__) #endif @@ -1087,7 +1087,7 @@ void assert_non_null(void *pointer); */ void assert_null(void *pointer); #else -#define assert_null(c) _assert_true(!(cast_ptr_to_largest_integral_type(c)), #c, \ +#define assert_null(c) _assert_true(!(cast_ptr_to_uintmax_type(c)), #c, \ __FILE__, __LINE__) #endif @@ -1105,8 +1105,8 @@ __FILE__, __LINE__) void assert_ptr_equal(void *a, void *b); #else #define assert_ptr_equal(a, b) \ - _assert_int_equal(cast_ptr_to_largest_integral_type(a), \ - cast_ptr_to_largest_integral_type(b), \ + _assert_int_equal(cast_ptr_to_uintmax_type(a), \ + cast_ptr_to_uintmax_type(b), \ __FILE__, __LINE__) #endif @@ -1124,8 +1124,8 @@ void assert_ptr_equal(void *a, void *b); void assert_ptr_not_equal(void *a, void *b); #else #define assert_ptr_not_equal(a, b) \ - _assert_int_not_equal(cast_ptr_to_largest_integral_type(a), \ - cast_ptr_to_largest_integral_type(b), \ + _assert_int_not_equal(cast_ptr_to_uintmax_type(a), \ + cast_ptr_to_uintmax_type(b), \ __FILE__, __LINE__) #endif diff --git a/src/cmocka.c b/src/cmocka.c index 513eb9d..0783c4d 100644 --- a/src/cmocka.c +++ b/src/cmocka.c @@ -737,7 +737,7 @@ static void free_value(const void *value, void *cleanup_value_data) { static void free_symbol_map_value(const void *value, void *cleanup_value_data) { SymbolMapValue * const map_value = (SymbolMapValue*)value; - const uintmax_t children = cast_ptr_to_largest_integral_type(cleanup_value_data); + const uintmax_t children = cast_ptr_to_uintmax_type(cleanup_value_data); assert_non_null(value); if (children == 0) { list_free(&map_value->symbol_values_list_head, @@ -2150,7 +2150,7 @@ void _test_free(void* const ptr, const char* file, const int line) { return; } - _assert_true(cast_ptr_to_largest_integral_type(ptr), "ptr", file, line); + _assert_true(cast_ptr_to_uintmax_type(ptr), "ptr", file, line); block_info.ptr = block - (MALLOC_GUARD_SIZE + sizeof(struct MallocBlockInfoData)); /* Check the guard blocks. */ -- cgit v1.2.3