refactor: replace char_u with char 17 - remove STRLCPY (#21235)

refactor: replace char_u with char

Work on https://github.com/neovim/neovim/issues/459
This commit is contained in:
dundargoc
2023-01-09 14:13:06 +01:00
committed by GitHub
parent fc2cd28547
commit 1492094003
43 changed files with 230 additions and 233 deletions

View File

@@ -3414,10 +3414,10 @@ void f_matchfuzzypos(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
/// Get line "lnum" and copy it into "buf[LSIZE]".
/// The copy is made because the regexp may make the line invalid when using a
/// mark.
static char_u *get_line_and_copy(linenr_T lnum, char_u *buf)
static char *get_line_and_copy(linenr_T lnum, char *buf)
{
char_u *line = (char_u *)ml_get(lnum);
STRLCPY(buf, line, LSIZE);
char *line = ml_get(lnum);
xstrlcpy(buf, line, LSIZE);
return buf;
}
@@ -3517,7 +3517,7 @@ void find_pattern_in_path(char *ptr, Direction dir, size_t len, bool whole, bool
if (lnum > end_lnum) { // do at least one line
lnum = end_lnum;
}
line = (char *)get_line_and_copy(lnum, file_line);
line = get_line_and_copy(lnum, (char *)file_line);
for (;;) {
if (incl_regmatch.regprog != NULL
@@ -3794,7 +3794,7 @@ search_line:
if (lnum >= end_lnum) {
goto exit_matched;
}
line = (char *)get_line_and_copy(++lnum, file_line);
line = get_line_and_copy(++lnum, (char *)file_line);
} else if (vim_fgets(line = (char *)file_line,
LSIZE, files[depth].fp)) {
goto exit_matched;
@@ -3984,7 +3984,7 @@ exit_matched:
if (++lnum > end_lnum) {
break;
}
line = (char *)get_line_and_copy(lnum, file_line);
line = get_line_and_copy(lnum, (char *)file_line);
}
already = NULL;
}