aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/file_search.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-07-31 15:55:01 +0200
committerGitHub <noreply@github.com>2022-07-31 15:55:01 +0200
commit68ec497d52bc8e93e12c74099ee9826b9469c3be (patch)
tree7baab4d6c3644125835ffa24ae0948ce4327d393 /src/nvim/file_search.c
parent86110ec93303a80ea14561d3976214ca27f0be63 (diff)
parent824a729628950d72834b98faf28d18b7a94eefb2 (diff)
downloadrneovim-68ec497d52bc8e93e12c74099ee9826b9469c3be.tar.gz
rneovim-68ec497d52bc8e93e12c74099ee9826b9469c3be.tar.bz2
rneovim-68ec497d52bc8e93e12c74099ee9826b9469c3be.zip
Merge pull request #19437 from dundargoc/refactor/char_u-to-char
refactor: replace char_u with char
Diffstat (limited to 'src/nvim/file_search.c')
-rw-r--r--src/nvim/file_search.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c
index ca276b8a40..810684eb61 100644
--- a/src/nvim/file_search.c
+++ b/src/nvim/file_search.c
@@ -82,10 +82,9 @@ typedef struct ff_stack {
char_u *ffs_fix_path;
char_u *ffs_wc_path;
- /* files/dirs found in the above directory, matched by the first wildcard
- * of wc_part
- */
- char_u **ffs_filearray;
+ // files/dirs found in the above directory, matched by the first wildcard
+ // of wc_part
+ char **ffs_filearray;
int ffs_filearray_size;
char_u ffs_filearray_cur; // needed for partly handled dirs
@@ -683,12 +682,12 @@ char_u *vim_findfile(void *search_ctx_arg)
* to handle the expansion of '**' into an empty string.
*/
if (stackp->ffs_filearray == NULL) {
- char_u *dirptrs[2];
+ char *dirptrs[2];
/* we use filepath to build the path expand_wildcards() should
* expand.
*/
- dirptrs[0] = file_path;
+ dirptrs[0] = (char *)file_path;
dirptrs[1] = NULL;
// if we have a start dir copy it in
@@ -743,7 +742,7 @@ char_u *vim_findfile(void *search_ctx_arg)
if (stackp->ffs_star_star_empty == 0) {
// if not done before, expand '**' to empty
stackp->ffs_star_star_empty = 1;
- dirptrs[1] = stackp->ffs_fix_path;
+ dirptrs[1] = (char *)stackp->ffs_fix_path;
}
}
@@ -773,9 +772,9 @@ char_u *vim_findfile(void *search_ctx_arg)
* Expand wildcards like "*" and "$VAR".
* If the path is a URL don't try this.
*/
- if (path_with_url((char *)dirptrs[0])) {
+ if (path_with_url(dirptrs[0])) {
stackp->ffs_filearray = xmalloc(sizeof(char *));
- stackp->ffs_filearray[0] = vim_strsave(dirptrs[0]);
+ stackp->ffs_filearray[0] = xstrdup(dirptrs[0]);
stackp->ffs_filearray_size = 1;
} else {
/* Add EW_NOTWILD because the expanded path may contain
@@ -801,10 +800,9 @@ char_u *vim_findfile(void *search_ctx_arg)
* We don't have further wildcards to expand, so we have to
* check for the final file now.
*/
- for (int i = stackp->ffs_filearray_cur;
- i < stackp->ffs_filearray_size; ++i) {
- if (!path_with_url((char *)stackp->ffs_filearray[i])
- && !os_isdir(stackp->ffs_filearray[i])) {
+ for (int i = stackp->ffs_filearray_cur; i < stackp->ffs_filearray_size; i++) {
+ if (!path_with_url(stackp->ffs_filearray[i])
+ && !os_isdir((char_u *)stackp->ffs_filearray[i])) {
continue; // not a directory
}
// prepare the filename to be checked for existence below
@@ -897,17 +895,13 @@ char_u *vim_findfile(void *search_ctx_arg)
}
}
} else {
- /*
- * still wildcards left, push the directories for further
- * search
- */
- for (int i = stackp->ffs_filearray_cur;
- i < stackp->ffs_filearray_size; ++i) {
- if (!os_isdir(stackp->ffs_filearray[i])) {
+ // still wildcards left, push the directories for further search
+ for (int i = stackp->ffs_filearray_cur; i < stackp->ffs_filearray_size; i++) {
+ if (!os_isdir((char_u *)stackp->ffs_filearray[i])) {
continue; // not a directory
}
ff_push(search_ctx,
- ff_create_stack_element(stackp->ffs_filearray[i],
+ ff_create_stack_element((char_u *)stackp->ffs_filearray[i],
rest_of_wildcards,
stackp->ffs_level - 1, 0));
}
@@ -927,11 +921,11 @@ char_u *vim_findfile(void *search_ctx_arg)
stackp->ffs_fix_path) == 0) {
continue; // don't repush same directory
}
- if (!os_isdir(stackp->ffs_filearray[i])) {
+ if (!os_isdir((char_u *)stackp->ffs_filearray[i])) {
continue; // not a directory
}
ff_push(search_ctx,
- ff_create_stack_element(stackp->ffs_filearray[i],
+ ff_create_stack_element((char_u *)stackp->ffs_filearray[i],
stackp->ffs_wc_path, stackp->ffs_level - 1, 1));
}
}