]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Const
authorNick Porter <nick@portercomputing.co.uk>
Thu, 22 Feb 2024 12:30:35 +0000 (12:30 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Thu, 22 Feb 2024 12:30:35 +0000 (12:30 +0000)
src/lib/unlang/xlat_builtin.c
src/lib/util/regex.c
src/lib/util/regex.h

index 628b21c9058a06dd9bce83afe8a711223f9a5fe7..7688b092cbcb2e59215abef805dfc495e5111b4e 100644 (file)
@@ -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;
index 5663bc7c01f40e15b1f16ba6a4367cd2709d6ff2..21091671974cdbd11e5882a48d64b813fb310662 100644 (file)
@@ -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)
index a04d1583f2f4c018b5a79c4e8edda5fcfdce5669..4285d25c830c41f25bd59b5fb13783806d926fe9 100644 (file)
@@ -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);