From: Nick Porter Date: Thu, 22 Feb 2024 12:30:35 +0000 (+0000) Subject: Const X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5719966fd33b9fb00daba01d7274b15d50bb6f5;p=thirdparty%2Ffreeradius-server.git Const --- diff --git a/src/lib/unlang/xlat_builtin.c b/src/lib/unlang/xlat_builtin.c index 628b21c9058..7688b092cbc 100644 --- a/src/lib/unlang/xlat_builtin.c +++ b/src/lib/unlang/xlat_builtin.c @@ -3143,16 +3143,17 @@ static int xlat_instantiate_subst_regex(xlat_inst_ctx_t const *xctx) * @ingroup xlat_functions */ static int xlat_func_subst_regex(TALLOC_CTX *ctx, fr_dcursor_t *out, - UNUSED xlat_ctx_t const *xctx, request_t *request, + xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args) { - xlat_subst_regex_inst_t *inst = talloc_get_type_abort(xctx->inst, xlat_subst_regex_inst_t); + xlat_subst_regex_inst_t const *inst = talloc_get_type_abort_const(xctx->inst, xlat_subst_regex_inst_t); fr_sbuff_t sbuff; fr_sbuff_marker_t start_m, end_m; char *buff; ssize_t slen; regex_t *pattern, *our_pattern = NULL; - fr_regex_flags_t *flags, our_flags = {}; + fr_regex_flags_t const *flags; + fr_regex_flags_t our_flags = {}; fr_value_box_t *vb; fr_value_box_t *subject_vb; fr_value_box_t *regex_vb; diff --git a/src/lib/util/regex.c b/src/lib/util/regex.c index 5663bc7c01f..21091671974 100644 --- a/src/lib/util/regex.c +++ b/src/lib/util/regex.c @@ -418,7 +418,7 @@ int regex_exec(regex_t *preg, char const *subject, size_t len, fr_regmatch_t *re * - >= 0 the length of the output string. * - < 0 on error. */ -int regex_substitute(TALLOC_CTX *ctx, char **out, size_t max_out, regex_t *preg, fr_regex_flags_t *flags, +int regex_substitute(TALLOC_CTX *ctx, char **out, size_t max_out, regex_t *preg, fr_regex_flags_t const *flags, char const *subject, size_t subject_len, char const *replacement, size_t replacement_len, fr_regmatch_t *regmatch) diff --git a/src/lib/util/regex.h b/src/lib/util/regex.h index a04d1583f2f..4285d25c830 100644 --- a/src/lib/util/regex.h +++ b/src/lib/util/regex.h @@ -178,7 +178,7 @@ ssize_t regex_flags_print(fr_sbuff_t *sbuff, fr_regex_flags_t const *flags); fr_regex_flags_t const *flags, bool subcaptures, bool runtime); int regex_exec(regex_t *preg, char const *subject, size_t len, fr_regmatch_t *regmatch) CC_HINT(nonnull(1,2)); #ifdef HAVE_REGEX_PCRE2 -int regex_substitute(TALLOC_CTX *ctx, char **out, size_t max_out, regex_t *preg, fr_regex_flags_t *flags, +int regex_substitute(TALLOC_CTX *ctx, char **out, size_t max_out, regex_t *preg, fr_regex_flags_t const *flags, char const *subject, size_t subject_len, char const *replacement, size_t replacement_len, fr_regmatch_t *regmatch);