From: Nick Porter Date: Tue, 14 Feb 2023 17:16:37 +0000 (+0000) Subject: Correct naming of slab element destructor X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2bc398248968d1bc138efc72d60a9ee11a16b53d;p=thirdparty%2Ffreeradius-server.git Correct naming of slab element destructor --- diff --git a/src/lib/util/slab.h b/src/lib/util/slab.h index 8783dc0c4e6..d46f011980a 100644 --- a/src/lib/util/slab.h +++ b/src/lib/util/slab.h @@ -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; \ diff --git a/src/lib/util/slab_tests.c b/src/lib/util/slab_tests.c index d8b29e89213..a5ce2a9cbd6 100644 --- a/src/lib/util/slab_tests.c +++ b/src/lib/util/slab_tests.c @@ -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);