diff options
author | dundargoc <gocdundar@gmail.com> | 2023-12-28 13:42:24 +0100 |
---|---|---|
committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-12-30 12:45:38 +0100 |
commit | c89292fcb7f2ebf06efb7c1d00c28f34c6f68fec (patch) | |
tree | b1257a572495337ca936c47839bb08aa45528c84 /src/nvim/file_search.c | |
parent | d634cd5b0bc3ac6bdf285432f74a1c10f12b6031 (diff) | |
download | rneovim-c89292fcb7f2ebf06efb7c1d00c28f34c6f68fec.tar.gz rneovim-c89292fcb7f2ebf06efb7c1d00c28f34c6f68fec.tar.bz2 rneovim-c89292fcb7f2ebf06efb7c1d00c28f34c6f68fec.zip |
refactor: follow style guide
Diffstat (limited to 'src/nvim/file_search.c')
-rw-r--r-- | src/nvim/file_search.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c index 76f7b7e1af..6be9556951 100644 --- a/src/nvim/file_search.c +++ b/src/nvim/file_search.c @@ -238,7 +238,6 @@ static const char e_path_too_long_for_completion[] void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, int free_visited, int find_what, void *search_ctx_arg, int tagfile, char *rel_fname) { - char *wc_part; ff_stack_T *sptr; ff_search_ctx_T *search_ctx; @@ -373,7 +372,7 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i // split into: // -fix path // -wildcard_stuff (might be NULL) - wc_part = vim_strchr(path, '*'); + char *wc_part = vim_strchr(path, '*'); if (wc_part != NULL) { int64_t llevel; int len; @@ -549,24 +548,22 @@ void vim_findfile_cleanup(void *ctx) /// NULL if nothing found. char *vim_findfile(void *search_ctx_arg) { - char *file_path; char *rest_of_wildcards; char *path_end = NULL; ff_stack_T *stackp = NULL; size_t len; char *p; char *suf; - ff_search_ctx_T *search_ctx; if (search_ctx_arg == NULL) { return NULL; } - search_ctx = (ff_search_ctx_T *)search_ctx_arg; + ff_search_ctx_T *search_ctx = (ff_search_ctx_T *)search_ctx_arg; // filepath is used as buffer for various actions and as the storage to // return a found filename. - file_path = xmalloc(MAXPATHL); + char *file_path = xmalloc(MAXPATHL); // store the end of the start dir -- needed for upward search if (search_ctx->ffsc_start_dir != NULL) { @@ -929,13 +926,11 @@ fail: /// Can handle it if the passed search_context is NULL; void vim_findfile_free_visited(void *search_ctx_arg) { - ff_search_ctx_T *search_ctx; - if (search_ctx_arg == NULL) { return; } - search_ctx = (ff_search_ctx_T *)search_ctx_arg; + ff_search_ctx_T *search_ctx = (ff_search_ctx_T *)search_ctx_arg; vim_findfile_free_visited_list(&search_ctx->ffsc_visited_lists_list); vim_findfile_free_visited_list(&search_ctx->ffsc_dir_visited_lists_list); } @@ -1157,9 +1152,7 @@ static void ff_push(ff_search_ctx_T *search_ctx, ff_stack_T *stack_ptr) /// @return NULL if stack is empty. static ff_stack_T *ff_pop(ff_search_ctx_T *search_ctx) { - ff_stack_T *sptr; - - sptr = search_ctx->ffsc_stack_ptr; + ff_stack_T *sptr = search_ctx->ffsc_stack_ptr; if (search_ctx->ffsc_stack_ptr != NULL) { search_ctx->ffsc_stack_ptr = search_ctx->ffsc_stack_ptr->ffs_prev; } @@ -1224,8 +1217,6 @@ static void ff_clear(ff_search_ctx_T *search_ctx) /// @return true if yes else false static bool ff_path_in_stoplist(char *path, int path_len, char **stopdirs_v) { - int i = 0; - // eat up trailing path separators, except the first while (path_len > 1 && vim_ispathsep(path[path_len - 1])) { path_len--; @@ -1236,7 +1227,7 @@ static bool ff_path_in_stoplist(char *path, int path_len, char **stopdirs_v) return true; } - for (i = 0; stopdirs_v[i] != NULL; i++) { + for (int i = 0; stopdirs_v[i] != NULL; i++) { if ((int)strlen(stopdirs_v[i]) > path_len) { // match for parent directory. So '/home' also matches // '/home/rks'. Check for PATHSEP in stopdirs_v[i], else |