diff options
-rw-r--r-- | src/path.c | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/src/path.c b/src/path.c index 91cf567418..1b22a1e656 100644 --- a/src/path.c +++ b/src/path.c @@ -115,37 +115,6 @@ char_u *gettail(char_u *fname) return p1; } -static char_u *gettail_dir(char_u *fname); - -/* - * Return the end of the directory name, on the first path - * separator: - * "/path/file", "/path/dir/", "/path//dir", "/file" - * ^ ^ ^ ^ - */ -static char_u *gettail_dir(char_u *fname) -{ - char_u *dir_end = fname; - char_u *next_dir_end = fname; - int look_for_sep = TRUE; - char_u *p; - - for (p = fname; *p != NUL; ) { - if (vim_ispathsep(*p)) { - if (look_for_sep) { - next_dir_end = p; - look_for_sep = FALSE; - } - } else { - if (!look_for_sep) - dir_end = next_dir_end; - look_for_sep = TRUE; - } - mb_ptr_adv(p); - } - return dir_end; -} - /* * Get pointer to tail of "fname", including path separators. Putting a NUL * here leaves the directory name. Takes care of "c:/" and "//". @@ -785,6 +754,8 @@ static char_u *get_path_cutoff(char_u *fname, garray_T *gap) return cutoff; } +static char_u *gettail_dir(char_u *fname); + /* * Sorts, removes duplicates and modifies all the fullpath names in "gap" so * that they are unique with respect to each other while conserving the part @@ -937,6 +908,36 @@ theend: } /* + * Return the end of the directory name, on the first path + * separator: + * "/path/file", "/path/dir/", "/path//dir", "/file" + * ^ ^ ^ ^ + */ +static char_u *gettail_dir(char_u *fname) +{ + char_u *dir_end = fname; + char_u *next_dir_end = fname; + int look_for_sep = TRUE; + char_u *p; + + for (p = fname; *p != NUL; ) { + if (vim_ispathsep(*p)) { + if (look_for_sep) { + next_dir_end = p; + look_for_sep = FALSE; + } + } else { + if (!look_for_sep) + dir_end = next_dir_end; + look_for_sep = TRUE; + } + mb_ptr_adv(p); + } + return dir_end; +} + + +/* * Calls globpath() with 'path' values for the given pattern and stores the * result in "gap". * Returns the total number of matches. |