diff options
author | ii14 <59243201+ii14@users.noreply.github.com> | 2023-04-01 02:49:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-01 08:49:51 +0800 |
commit | d5f6176e6dc4b4e12fc5061ca6e87f4af533e46a (patch) | |
tree | ed51aa26f2b10c950c9bf2d7d035450335d01b55 /src/nvim/regexp.c | |
parent | 83bfd94d1df5eecb8e4069a227c7d24598636d63 (diff) | |
download | rneovim-d5f6176e6dc4b4e12fc5061ca6e87f4af533e46a.tar.gz rneovim-d5f6176e6dc4b4e12fc5061ca6e87f4af533e46a.tar.bz2 rneovim-d5f6176e6dc4b4e12fc5061ca6e87f4af533e46a.zip |
refactor: add const and remove unnecessary casts (#22841)
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r-- | src/nvim/regexp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 122f3e2020..0b9a9bbdec 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -2304,10 +2304,10 @@ static uint8_t regname[][30] = { // Returns the program in allocated memory. // Use vim_regfree() to free the memory. // Returns NULL for an error. -regprog_T *vim_regcomp(char *expr_arg, int re_flags) +regprog_T *vim_regcomp(const char *expr_arg, int re_flags) { regprog_T *prog = NULL; - char *expr = expr_arg; + const char *expr = expr_arg; regexp_engine = (int)p_re; @@ -2403,7 +2403,7 @@ void free_regexp_stuff(void) #endif -static void report_re_switch(char *pat) +static void report_re_switch(const char *pat) { if (p_verbose > 0) { verbose_enter(); @@ -2425,7 +2425,7 @@ static void report_re_switch(char *pat) /// @param nl /// /// @return true if there is a match, false if not. -static bool vim_regexec_string(regmatch_T *rmp, char *line, colnr_T col, bool nl) +static bool vim_regexec_string(regmatch_T *rmp, const char *line, colnr_T col, bool nl) { regexec_T rex_save; bool rex_in_use_save = rex_in_use; @@ -2482,7 +2482,7 @@ static bool vim_regexec_string(regmatch_T *rmp, char *line, colnr_T col, bool nl // Note: "*prog" may be freed and changed. // Return true if there is a match, false if not. -bool vim_regexec_prog(regprog_T **prog, bool ignore_case, char *line, colnr_T col) +bool vim_regexec_prog(regprog_T **prog, bool ignore_case, const char *line, colnr_T col) { regmatch_T regmatch = { .regprog = *prog, .rm_ic = ignore_case }; bool r = vim_regexec_string(®match, line, col, false); @@ -2492,7 +2492,7 @@ bool vim_regexec_prog(regprog_T **prog, bool ignore_case, char *line, colnr_T co // Note: "rmp->regprog" may be freed and changed. // Return true if there is a match, false if not. -bool vim_regexec(regmatch_T *rmp, char *line, colnr_T col) +bool vim_regexec(regmatch_T *rmp, const char *line, colnr_T col) { return vim_regexec_string(rmp, line, col, false); } @@ -2500,7 +2500,7 @@ bool vim_regexec(regmatch_T *rmp, char *line, colnr_T col) // Like vim_regexec(), but consider a "\n" in "line" to be a line break. // Note: "rmp->regprog" may be freed and changed. // Return true if there is a match, false if not. -bool vim_regexec_nl(regmatch_T *rmp, char *line, colnr_T col) +bool vim_regexec_nl(regmatch_T *rmp, const char *line, colnr_T col) { return vim_regexec_string(rmp, line, col, true); } |