From: Alan T. DeKok Date: Sat, 29 Mar 2025 19:48:20 +0000 (-0400) Subject: remove unused function X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45d0da1ab78ff9bbe7ba87625165ac79b9309616;p=thirdparty%2Ffreeradius-server.git remove unused function --- diff --git a/src/lib/util/calc.c b/src/lib/util/calc.c index 12638c8e3bb..a33915b4aa6 100644 --- a/src/lib/util/calc.c +++ b/src/lib/util/calc.c @@ -2573,71 +2573,6 @@ int fr_value_calc_unary_op(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_token_t op, } -/** Apply a set of operations in order to create an output box. - * - */ -int fr_value_calc_list_op(TALLOC_CTX *ctx, fr_value_box_t *box, fr_token_t op, fr_value_box_list_t const *list) -{ - /* - * For octets and string and prepend / append, figure out - * first how long the output is, create a string that - * long, and then loop assigning the values. Doing it - * this way avoids a lot of intermediate garbage. - */ - if (fr_type_is_variable_size(box->type)) { - bool tainted = false; - int rcode; - size_t len = 0; - uint8_t *str, *p; - fr_value_box_t src; - - fr_value_box_list_foreach(list, a) { - if (a->type != box->type) { - len = 0; - break; - } - - len += a->vb_length; - } - - if (!len) goto brute_force; - - if (box->type == FR_TYPE_STRING) { - str = talloc_array(ctx, uint8_t, len); - if (!str) return -1; - } else { - str = talloc_array(ctx, uint8_t, len + 1); - if (!str) return -1; - - str[len] = '\0'; - } - - p = str; - fr_value_box_list_foreach(list, a) { - memcpy(p, a->vb_octets, a->vb_length); - p += a->vb_length; - tainted |= a->tainted; - } - - if (box->type == FR_TYPE_STRING) { - fr_value_box_bstrndup_shallow(&src, NULL, (char const *) str, len, tainted); - } else { - fr_value_box_memdup_shallow(&src, NULL, str, len, tainted); - } - - rcode = fr_value_calc_binary_op(ctx, box, box->type, box, op, &src); - talloc_free(str); - return rcode; - } - -brute_force: - fr_value_box_list_foreach(list, a) { - if (fr_value_calc_binary_op(ctx, box, box->type, box, op, a) < 0) return -1; - } - - return 0; -} - /* * Empty lists are empty: * diff --git a/src/lib/util/calc.h b/src/lib/util/calc.h index 5e2ebb782a6..7da3d56b776 100644 --- a/src/lib/util/calc.h +++ b/src/lib/util/calc.h @@ -40,8 +40,6 @@ int fr_value_calc_unary_op(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_token_t op, int fr_value_calc_nary_op(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_type_t type, fr_token_t op, fr_value_box_t const *group) CC_HINT(nonnull(2,5)); -int fr_value_calc_list_op(TALLOC_CTX *ctx, fr_value_box_t *box, fr_token_t op, fr_value_box_list_t const *list); - int fr_value_calc_list_cmp(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_value_box_list_t const *list1, fr_token_t op, fr_value_box_list_t const *list2) CC_HINT(nonnull); #ifdef __cplusplus