diff options
author | Thomas Wienecke <wienecke.t@gmail.com> | 2014-03-30 14:12:25 +0200 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-03 10:32:41 -0300 |
commit | df78edbc926051082f2cf161332b451230787d03 (patch) | |
tree | 920a1a9b3d905e96f944589cd1ea9417da7cc3a8 | |
parent | 98b1f73c3f364d11ba54e9950fc2168712da3996 (diff) | |
download | rneovim-df78edbc926051082f2cf161332b451230787d03.tar.gz rneovim-df78edbc926051082f2cf161332b451230787d03.tar.bz2 rneovim-df78edbc926051082f2cf161332b451230787d03.zip |
Move gettail_dir more closely to its usage.
-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. |