From: Alan T. DeKok Date: Sun, 10 Sep 2023 12:43:21 +0000 (-0400) Subject: remove unused function X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d6d4ecdd748846a9e0b9fed34125185a783bb09;p=thirdparty%2Ffreeradius-server.git remove unused function --- diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index 19fe00e0edd..7cb63444bc2 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -293,73 +293,6 @@ fr_pair_t *fr_pair_afrom_da(TALLOC_CTX *ctx, fr_dict_attr_t const *da) return vp; } -/** Allocate a pooled object that can hold a fr_pair_t any unknown attributes and value buffer - * - * @param[in] ctx to allocate the pooled object in. - * @param[in] da If unknown, will be duplicated. - * @param[in] value_len The expected length of the buffer. +1 will be added if this - * if a FR_TYPE_STRING attribute. - */ -fr_pair_t *fr_pair_afrom_da_with_pool(TALLOC_CTX *ctx, fr_dict_attr_t const *da, size_t value_len) -{ - fr_pair_t *vp; - - unsigned int headers = 1; - - /* - * Dict attributes allocate extensions - * contiguously, so we only need one - * header even though there's a variable - * length name buff. - */ - if (da->flags.is_unknown) { - headers++; - value_len += talloc_array_length(da); /* accounts for all extensions */ - } - - switch (da->type) { - case FR_TYPE_OCTETS: - headers++; - break; - - case FR_TYPE_STRING: - headers++; - value_len++; - break; - - default: - fr_strerror_printf("Pooled fr_pair_t can only be allocated for " - "'string' and 'octets' types not '%s'", - fr_type_to_str(da->type)); - return NULL; - - } - - vp = talloc_zero_pooled_object(ctx, fr_pair_t, headers, value_len); - if (unlikely(!vp)) { - fr_strerror_printf("Out of memory"); - return NULL; - } - talloc_set_destructor(vp, _fr_pair_free); - - pair_init_null(vp); - - /* - * If we get passed an unknown da, we need to ensure that - * it's parented by "vp". - */ - if (da->flags.is_unknown) { - fr_dict_attr_t const *unknown; - - unknown = fr_dict_unknown_copy(vp, da); - da = unknown; - } - - pair_init_from_da(vp, da); - - return vp; -} - /** Re-initialise an attribute with a different da * * If the new da has a different type to the old da, we'll attempt to cast diff --git a/src/lib/util/pair.h b/src/lib/util/pair.h index 52efb9e15b1..73c03aeb11c 100644 --- a/src/lib/util/pair.h +++ b/src/lib/util/pair.h @@ -432,9 +432,6 @@ fr_pair_t *fr_pair_root_afrom_da(TALLOC_CTX *ctx, fr_dict_attr_t const *da) CC_H /** @hidecallergraph */ fr_pair_t *fr_pair_afrom_da(TALLOC_CTX *ctx, fr_dict_attr_t const *da) CC_HINT(warn_unused_result) CC_HINT(nonnull(2)); -fr_pair_t *fr_pair_afrom_da_with_pool(TALLOC_CTX *ctx, fr_dict_attr_t const *da, size_t value_len) - CC_HINT(warn_unused_result) CC_HINT(nonnull(2)); - int fr_pair_reinit_from_da(fr_pair_list_t *list, fr_pair_t *vp, fr_dict_attr_t const *da) CC_HINT(nonnull(2, 3));