mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +00:00
refactor: replace char_u with char 20 (#21714)
refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459
This commit is contained in:
@@ -347,7 +347,7 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
|
||||
}
|
||||
|
||||
size_t dircount = 1;
|
||||
search_ctx->ffsc_stopdirs_v = xmalloc(sizeof(char_u *));
|
||||
search_ctx->ffsc_stopdirs_v = xmalloc(sizeof(char *));
|
||||
|
||||
do {
|
||||
char *helper;
|
||||
@@ -355,7 +355,7 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
|
||||
|
||||
helper = walker;
|
||||
ptr = xrealloc(search_ctx->ffsc_stopdirs_v,
|
||||
(dircount + 1) * sizeof(char_u *));
|
||||
(dircount + 1) * sizeof(char *));
|
||||
search_ctx->ffsc_stopdirs_v = ptr;
|
||||
walker = vim_strchr(walker, ';');
|
||||
if (walker) {
|
||||
@@ -447,11 +447,11 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
|
||||
add_pathsep(ff_expand_buffer);
|
||||
{
|
||||
size_t eb_len = strlen(ff_expand_buffer);
|
||||
char_u *buf = xmalloc(eb_len + strlen(search_ctx->ffsc_fix_path) + 1);
|
||||
char *buf = xmalloc(eb_len + strlen(search_ctx->ffsc_fix_path) + 1);
|
||||
|
||||
STRCPY(buf, ff_expand_buffer);
|
||||
STRCPY(buf + eb_len, search_ctx->ffsc_fix_path);
|
||||
if (os_isdir((char *)buf)) {
|
||||
if (os_isdir(buf)) {
|
||||
STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path);
|
||||
add_pathsep(ff_expand_buffer);
|
||||
} else {
|
||||
@@ -555,7 +555,7 @@ char_u *vim_findfile(void *search_ctx_arg)
|
||||
{
|
||||
char *file_path;
|
||||
char *rest_of_wildcards;
|
||||
char_u *path_end = NULL;
|
||||
char *path_end = NULL;
|
||||
ff_stack_T *stackp = NULL;
|
||||
size_t len;
|
||||
char *p;
|
||||
@@ -574,7 +574,7 @@ char_u *vim_findfile(void *search_ctx_arg)
|
||||
|
||||
// store the end of the start dir -- needed for upward search
|
||||
if (search_ctx->ffsc_start_dir != NULL) {
|
||||
path_end = (char_u *)&search_ctx->ffsc_start_dir[strlen(search_ctx->ffsc_start_dir)];
|
||||
path_end = &search_ctx->ffsc_start_dir[strlen(search_ctx->ffsc_start_dir)];
|
||||
}
|
||||
|
||||
// upward search loop
|
||||
@@ -886,16 +886,16 @@ char_u *vim_findfile(void *search_ctx_arg)
|
||||
|
||||
// is the last starting directory in the stop list?
|
||||
if (ff_path_in_stoplist(search_ctx->ffsc_start_dir,
|
||||
(int)(path_end - (char_u *)search_ctx->ffsc_start_dir),
|
||||
(int)(path_end - search_ctx->ffsc_start_dir),
|
||||
search_ctx->ffsc_stopdirs_v) == true) {
|
||||
break;
|
||||
}
|
||||
|
||||
// cut of last dir
|
||||
while (path_end > (char_u *)search_ctx->ffsc_start_dir && vim_ispathsep(*path_end)) {
|
||||
while (path_end > search_ctx->ffsc_start_dir && vim_ispathsep(*path_end)) {
|
||||
path_end--;
|
||||
}
|
||||
while (path_end > (char_u *)search_ctx->ffsc_start_dir && !vim_ispathsep(path_end[-1])) {
|
||||
while (path_end > search_ctx->ffsc_start_dir && !vim_ispathsep(path_end[-1])) {
|
||||
path_end--;
|
||||
}
|
||||
*path_end = 0;
|
||||
@@ -1025,7 +1025,7 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char *filename,
|
||||
/// - char by char comparison is OK
|
||||
/// - the only differences are in the counters behind a '**', so
|
||||
/// '**\20' is equal to '**\24'
|
||||
static bool ff_wc_equal(char_u *s1, char_u *s2)
|
||||
static bool ff_wc_equal(char *s1, char *s2)
|
||||
{
|
||||
int i, j;
|
||||
int c1 = NUL;
|
||||
@@ -1042,8 +1042,8 @@ static bool ff_wc_equal(char_u *s1, char_u *s2)
|
||||
}
|
||||
|
||||
for (i = 0, j = 0; s1[i] != NUL && s2[j] != NUL;) {
|
||||
c1 = utf_ptr2char((char *)s1 + i);
|
||||
c2 = utf_ptr2char((char *)s2 + j);
|
||||
c1 = utf_ptr2char(s1 + i);
|
||||
c2 = utf_ptr2char(s2 + j);
|
||||
|
||||
if ((p_fic ? mb_tolower(c1) != mb_tolower(c2) : c1 != c2)
|
||||
&& (prev1 != '*' || prev2 != '*')) {
|
||||
@@ -1052,8 +1052,8 @@ static bool ff_wc_equal(char_u *s1, char_u *s2)
|
||||
prev2 = prev1;
|
||||
prev1 = c1;
|
||||
|
||||
i += utfc_ptr2len((char *)s1 + i);
|
||||
j += utfc_ptr2len((char *)s2 + j);
|
||||
i += utfc_ptr2len(s1 + i);
|
||||
j += utfc_ptr2len(s2 + j);
|
||||
}
|
||||
return s1[i] == s2[j];
|
||||
}
|
||||
@@ -1086,7 +1086,7 @@ static int ff_check_visited(ff_visited_T **visited_list, char *fname, char *wc_p
|
||||
|| (!url && vp->file_id_valid
|
||||
&& os_fileid_equal(&(vp->file_id), &file_id))) {
|
||||
// are the wildcard parts equal
|
||||
if (ff_wc_equal((char_u *)vp->ffv_wc_path, (char_u *)wc_path)) {
|
||||
if (ff_wc_equal(vp->ffv_wc_path, wc_path)) {
|
||||
// already visited
|
||||
return FAIL;
|
||||
}
|
||||
@@ -1453,7 +1453,7 @@ char *find_file_in_path_option(char *ptr, size_t len, int options, int first, ch
|
||||
|
||||
did_findfile_init = false;
|
||||
} else {
|
||||
char_u *r_ptr;
|
||||
char *r_ptr;
|
||||
|
||||
if (dir == NULL || *dir == NUL) {
|
||||
// We searched all paths of the option, now we can free the search context.
|
||||
@@ -1469,9 +1469,9 @@ char *find_file_in_path_option(char *ptr, size_t len, int options, int first, ch
|
||||
copy_option_part(&dir, buf, MAXPATHL, " ,");
|
||||
|
||||
// get the stopdir string
|
||||
r_ptr = vim_findfile_stopdir((char_u *)buf);
|
||||
r_ptr = (char *)vim_findfile_stopdir((char_u *)buf);
|
||||
fdip_search_ctx = vim_findfile_init(buf, ff_file_to_find,
|
||||
(char *)r_ptr, 100, false, find_what,
|
||||
r_ptr, 100, false, find_what,
|
||||
fdip_search_ctx, false, rel_fname);
|
||||
if (fdip_search_ctx != NULL) {
|
||||
did_findfile_init = true;
|
||||
|
Reference in New Issue
Block a user