# HG changeset patch # User Mike Becker # Date 1730224010 -3600 # Node ID 18741059da473f3093ebf25e874085aa71417011 # Parent a1d87e8fff6db7e1407efe9dfdf0f1dd905cedec remove cx_swap_ptr() diff -r a1d87e8fff6d -r 18741059da47 src/cx/utils.h --- 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) diff -r a1d87e8fff6d -r 18741059da47 tests/test_utils.c --- 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);