]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Correct naming of slab element destructor
authorNick Porter <nick@portercomputing.co.uk>
Tue, 14 Feb 2023 17:16:37 +0000 (17:16 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Tue, 14 Feb 2023 17:26:09 +0000 (17:26 +0000)
src/lib/util/slab.h
src/lib/util/slab_tests.c

index 8783dc0c4e6947e89ca28edf609d8b1bc6b40003..d46f011980ab1ccdf1fa95617aea519ca563c7bb 100644 (file)
@@ -293,7 +293,7 @@ extern "C" {
         * @param[in] func      Function to attach. \
         * @param[in] uctx      to be passed to func. \
         */ \
-       static inline CC_HINT(nonnull(1,2)) void fr_ ## _type ## _slab_set_destructor(_type *elem, fr_ ## _type ## _slab_free_t func, void *uctx) \
+       static inline CC_HINT(nonnull(1,2)) void fr_ ## _name ## _slab_element_set_destructor(_type *elem, fr_ ## _type ## _slab_free_t func, void *uctx) \
        { \
                fr_ ## _name ## _slab_element_t *element = (fr_ ## _name ## _slab_element_t *)elem; \
                element->free = func; \
index d8b29e89213ccdbbb9427ec3a7e998fa4bf8f87a..a5ce2a9cbd6e1703d47c6b47c3faf23050cf7e30 100644 (file)
@@ -67,7 +67,7 @@ static void test_alloc(void)
 
        /* "if" to keep clang scan happy */
        if (test_elements[0]) test_elements[0]->name = talloc_strdup(test_elements[0], "Hello there");
-       if (test_elements[0]) fr_test_element_t_slab_set_destructor(test_elements[0], test_element_free, &test_uctx);
+       if (test_elements[0]) fr_test_slab_element_set_destructor(test_elements[0], test_element_free, &test_uctx);
 
        test_elements[1] = fr_test_slab_reserve(test_slab_list);
        TEST_CHECK(test_elements[1] != NULL);
@@ -79,7 +79,7 @@ static void test_alloc(void)
        test_elements[2] = fr_test_slab_reserve(test_slab_list);
        TEST_CHECK(test_elements[2] != NULL);
        if (test_elements[2]) test_elements[2]->name = talloc_strdup(test_elements[2], "Hello there testing");
-       if (test_elements[2]) fr_test_element_t_slab_set_destructor(test_elements[2], test_element_free, &test_uctx2);
+       if (test_elements[2]) fr_test_slab_element_set_destructor(test_elements[2], test_element_free, &test_uctx2);
        TEST_CHECK_RET(fr_test_slab_num_allocated(test_slab_list), 2);
        TEST_CHECK_RET(fr_test_slab_num_elements_used(test_slab_list), 3);
 
@@ -173,7 +173,7 @@ static void test_reuse_reset(void)
        test_uctx.count = 0;
 
        if (test_elements[0]) test_elements[0]->name = talloc_strdup(test_elements[0], "Hello there");
-       if (test_elements[0]) fr_test_element_t_slab_set_destructor(test_elements[0], test_element_free, &test_uctx);
+       if (test_elements[0]) fr_test_slab_element_set_destructor(test_elements[0], test_element_free, &test_uctx);
 
        test_elements[1] = fr_test_slab_reserve(test_slab_list);
        TEST_CHECK(test_elements[1] != NULL);
@@ -235,7 +235,7 @@ static void test_reuse_noreset(void)
        test_uctx.count = 0;
 
        if (test_elements[0]) test_elements[0]->name = talloc_strdup(test_elements[0], "Hello there");
-       if (test_elements[0]) fr_test_element_t_slab_set_destructor(test_elements[0], test_element_free, &test_uctx);
+       if (test_elements[0]) fr_test_slab_element_set_destructor(test_elements[0], test_element_free, &test_uctx);
 
        test_elements[1] = fr_test_slab_reserve(test_slab_list);
        TEST_CHECK(test_elements[1] != NULL);
@@ -287,7 +287,7 @@ static void test_free(void)
        test_uctx.count = 0;
 
        if (test_element) test_element->name = talloc_strdup(test_element, "Hello there");
-       if (test_element) fr_test_element_t_slab_set_destructor(test_element, test_element_free, &test_uctx);
+       if (test_element) fr_test_slab_element_set_destructor(test_element, test_element_free, &test_uctx);
 
        if (test_element) talloc_free(test_element);
        TEST_CHECK(test_uctx.count == 11);