diff -r cf19b7820ff0 -r 94360453bce4 tests/test_string.c --- a/tests/test_string.c Thu Dec 25 12:07:37 2025 +0100 +++ b/tests/test_string.c Sun Dec 28 14:10:14 2025 +0100 @@ -401,26 +401,22 @@ CxAllocator *alloc = &talloc.base; CX_TEST_DO { - cxmutstr t1 = {0}; - CX_TEST_ASSERT(0 == cx_strcat_a(alloc, &t1, 2, s1, s2)); + cxmutstr t1 = cx_strcat_a(alloc, CX_NULLSTR, 2, s1, s2); CX_TEST_ASSERT(0 == cx_strcmp(t1, "1234")); ASSERT_ZERO_TERMINATED(t1); cx_strfree_a(alloc, &t1); - cxmutstr t2 = {0}; - CX_TEST_ASSERT(0 == cx_strcat_a(alloc, &t2, 3, s1, s2, s3)); + cxmutstr t2 = cx_strcat_a(alloc, CX_NULLSTR, 3, s1, s2, s3); CX_TEST_ASSERT(0 == cx_strcmp(t2, "123456")); ASSERT_ZERO_TERMINATED(t2); cx_strfree_a(alloc, &t2); - cxmutstr t3 = {0}; - CX_TEST_ASSERT(0 == cx_strcat_a(alloc, &t3, 6, s1, sn, s2, sn, s3, sn)); + cxmutstr t3 = cx_strcat_a(alloc, CX_NULLSTR, 6, s1, sn, s2, sn, s3, sn); CX_TEST_ASSERT(0 == cx_strcmp(t3, "123456")); ASSERT_ZERO_TERMINATED(t3); cx_strfree_a(alloc, &t3); - cxmutstr t4 = {0}; - CX_TEST_ASSERT(0 == cx_strcat_a(alloc, &t4, 2, sn, sn)); + cxmutstr t4 = cx_strcat_a(alloc, CX_NULLSTR, 2, sn, sn); CX_TEST_ASSERT(0 == cx_strcmp(t4, "")); ASSERT_ZERO_TERMINATED(t4); cx_strfree_a(alloc, &t4); @@ -428,15 +424,14 @@ CX_TEST_ASSERT(cx_testing_allocator_verify(&talloc)); // use the macro - cxmutstr t5 = {0}; - CX_TEST_ASSERT(0 == cx_strcat(&t5, 3, s3, s1, s2)); + cxmutstr t5 = cx_strcat(CX_NULLSTR, 3, s3, s1, s2); CX_TEST_ASSERT(0 == cx_strcmp(t5, "561234")); ASSERT_ZERO_TERMINATED(t5); cx_strfree(&t5); // use an initial string - cxmutstr t6 = cx_strdup(cx_str("Hello")); - CX_TEST_ASSERT(0 == cx_strcat(&t6, 2, cx_str(", "), cx_str("World!"))); + cxmutstr t6 = cx_strdup("Hello"); + t6 = cx_strcat(t6, 2, cx_str(", "), cx_str("World!")); CX_TEST_ASSERT(0 == cx_strcmp(t6, "Hello, World!")); ASSERT_ZERO_TERMINATED(t6); cx_strfree(&t6); @@ -447,8 +442,7 @@ cxstring b = cx_strn(fakestr, SIZE_MAX / 3 - 5); cxstring c = cx_strn(fakestr, SIZE_MAX / 3 + 20); errno = 0; - cxmutstr z = {0}; - CX_TEST_ASSERT(0 != cx_strcat(&z, 3, a, b, c)); + cxmutstr z = cx_strcat(CX_NULLSTR, 3, a, b, c); CX_TEST_ASSERT(errno == EOVERFLOW); CX_TEST_ASSERT(z.ptr == NULL); CX_TEST_ASSERT(z.length == 0); @@ -468,8 +462,7 @@ cxstring s9 = cx_str("xy"); CX_TEST_DO { - cxmutstr r = {0}; - CX_TEST_ASSERT(0 == cx_strcat(&r, 9, s1, s2, s3, s4, s5, s6, s7, s8, s9)); + cxmutstr r = cx_strcat(CX_NULLSTR, 9, s1, s2, s3, s4, s5, s6, s7, s8, s9); CX_TEST_ASSERT(0 == cx_strcmp(r, "123456789abcdef0xy")); ASSERT_ZERO_TERMINATED(r); cx_strfree(&r);