Tue, 29 Oct 2024 18:46:50 +0100
remove cx_swap_ptr()
src/cx/utils.h | file | annotate | diff | comparison | revisions | |
tests/test_utils.c | file | annotate | diff | comparison | revisions |
--- a/src/cx/utils.h Tue Oct 29 18:15:06 2024 +0100 +++ b/src/cx/utils.h Tue Oct 29 18:46:50 2024 +0100 @@ -50,15 +50,6 @@ */ #define cx_for_n(varname, n) for (size_t varname = 0 ; (varname) < (n) ; (varname)++) -/** - * Convenience macro for swapping two pointers. - */ -#ifdef __cplusplus -#define cx_swap_ptr(left, right) do {auto cx_tmp_swap_var = left; left = right; right = cx_tmp_swap_var;} while(0) -#else -#define cx_swap_ptr(left, right) do {void *cx_tmp_swap_var = left; left = right; right = cx_tmp_swap_var;} while(0) -#endif - // cx_szmul() definition #if (__GNUC__ >= 5 || defined(__clang__)) && !defined(CX_NO_SZMUL_BUILTIN)
--- a/tests/test_utils.c Tue Oct 29 18:15:06 2024 +0100 +++ b/tests/test_utils.c Tue Oct 29 18:46:50 2024 +0100 @@ -106,18 +106,6 @@ } } -CX_TEST(test_swap_ptr) { - int i = 5; - int j = 8; - int *ip = &i; - int *jp = &j; - CX_TEST_DO { - cx_swap_ptr(ip, jp); - CX_TEST_ASSERT(ip == &j); - CX_TEST_ASSERT(jp == &i); - } -} - CX_TEST(test_szmul) { size_t r; int e; @@ -246,7 +234,6 @@ cx_test_register(suite, test_stream_bncopy); cx_test_register(suite, test_stream_ncopy); cx_test_register(suite, test_forn); - cx_test_register(suite, test_swap_ptr); cx_test_register(suite, test_szmul); #ifdef CX_SZMUL_BUILTIN cx_test_register(suite, test_szmul_impl);