From: Alan T. DeKok Date: Fri, 15 Sep 2023 16:41:36 +0000 (-0400) Subject: move legacy function to the only place which uses it X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5f0863d8491ac33135d1124cd7e7fb96cf5555a;p=thirdparty%2Ffreeradius-server.git move legacy function to the only place which uses it --- diff --git a/src/lib/util/pair.h b/src/lib/util/pair.h index ffea04126e6..5a0f59c9586 100644 --- a/src/lib/util/pair.h +++ b/src/lib/util/pair.h @@ -831,8 +831,6 @@ static inline fr_slen_t CC_HINT(nonnull(2,4)) fr_pair_aprint_secure(TALLOC_CTX *ctx, char **out, fr_dict_attr_t const *parent, fr_pair_t const *vp) SBUFF_OUT_TALLOC_FUNC_NO_LEN_DEF(fr_pair_print_secure, parent, vp) -void fr_pair_fprint(FILE *, fr_pair_t const *vp) CC_HINT(nonnull); - #define fr_pair_list_log(_log, _lvl, _list) _fr_pair_list_log(_log, _lvl, NULL, _list, __FILE__, __LINE__) void _fr_pair_list_log(fr_log_t const *log, int lvl, fr_pair_t *parent, fr_pair_list_t const *list, char const *file, int line) CC_HINT(nonnull(1,4)); diff --git a/src/lib/util/pair_print.c b/src/lib/util/pair_print.c index 2dd0de64d75..db6ec888cc7 100644 --- a/src/lib/util/pair_print.c +++ b/src/lib/util/pair_print.c @@ -237,33 +237,6 @@ ssize_t fr_pair_list_print(fr_sbuff_t *out, fr_dict_attr_t const *parent, fr_pai FR_SBUFF_SET_RETURN(out, &our_out); } -/** Print one attribute and value to FP - * - * Complete string with '\\t' and '\\n' is written to buffer before printing to - * avoid issues when running with multiple threads. - * - * This function will print *flattened* lists, as is suitable for use - * with rlm_detail. In fact, the only user of this function is - * rlm_detail. - * - * @param fp to output to. - * @param vp to print. - */ -void fr_pair_fprint(FILE *fp, fr_pair_t const *vp) -{ - char buff[1024]; - fr_sbuff_t sbuff = FR_SBUFF_OUT(buff, sizeof(buff)); - - PAIR_VERIFY(vp); - - (void) fr_sbuff_in_char(&sbuff, '\t'); - (void) fr_pair_print(&sbuff, NULL, vp); - (void) fr_sbuff_in_char(&sbuff, '\n'); - - fputs(buff, fp); -} - - static void fr_pair_list_log_sbuff(fr_log_t const *log, int lvl, fr_pair_t *parent, fr_pair_list_t const *list, char const *file, int line, fr_sbuff_t *sbuff) { fr_dict_attr_t const *parent_da = NULL; diff --git a/src/modules/rlm_detail/rlm_detail.c b/src/modules/rlm_detail/rlm_detail.c index 60dc3e7e00d..5a4024d72c8 100644 --- a/src/modules/rlm_detail/rlm_detail.c +++ b/src/modules/rlm_detail/rlm_detail.c @@ -118,6 +118,32 @@ fr_dict_attr_autoload_t rlm_detail_dict_attr[] = { { NULL } }; +/** Print one attribute and value to FP + * + * Complete string with '\\t' and '\\n' is written to buffer before printing to + * avoid issues when running with multiple threads. + * + * @todo - This function should print *flattened* lists. + * + * @param fp to output to. + * @param vp to print. + */ +static void CC_HINT(nonnull) fr_pair_fprint(FILE *fp, fr_pair_t const *vp) +{ + char buff[1024]; + fr_sbuff_t sbuff = FR_SBUFF_OUT(buff, sizeof(buff)); + + PAIR_VERIFY(vp); + + (void) fr_sbuff_in_char(&sbuff, '\t'); + (void) fr_pair_print(&sbuff, NULL, vp); + (void) fr_sbuff_in_char(&sbuff, '\n'); + + fputs(buff, fp); +} + + + /** Generic function for parsing conf pair values as int * * @note This should be used for enum types as c99 6.4.4.3 states that the enumeration