diff options
author | John <john.schmidt.h@gmail.com> | 2014-04-13 20:30:53 +0200 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-29 09:24:34 -0300 |
commit | 42efbfd2fde0942cc7826993191206c24a34b555 (patch) | |
tree | b0cb7c94f06626734da396e20b2ee2f10c300340 /src/path.h | |
parent | c57002a7c34a553f68eeb65fa6e5b1e3a9e3ad24 (diff) | |
download | rneovim-42efbfd2fde0942cc7826993191206c24a34b555.tar.gz rneovim-42efbfd2fde0942cc7826993191206c24a34b555.tar.bz2 rneovim-42efbfd2fde0942cc7826993191206c24a34b555.zip |
Test and refactor `shorten_fname` and `shorten_fname1`
Rename `shorten_fname` -> `path_shorten_fname`
Rename `shorten_fname1` -> `path_shorten_fname_if_possible`
Diffstat (limited to 'src/path.h')
-rw-r--r-- | src/path.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/path.h b/src/path.h index 7ef4296278..51503c3bdd 100644 --- a/src/path.h +++ b/src/path.h @@ -83,8 +83,26 @@ int after_pathsep(char_u *b, char_u *p); int same_directory(char_u *f1, char_u *f2); int pathcmp(const char *p, const char *q, int maxlen); int mch_expandpath(garray_T *gap, char_u *path, int flags); -char_u *shorten_fname1(char_u *full_path); -char_u *shorten_fname(char_u *full_path, char_u *dir_name); + +/// Try to find a shortname by comparing the fullname with the current +/// directory. +/// +/// @param full_path The full path of the file. +/// @return +/// - Pointer into `full_path` if shortened. +/// - `full_path` unchanged if no shorter name is possible. +/// - NULL if `full_path` is NULL. +char_u *path_shorten_fname_if_possible(char_u *full_path); + +/// Try to find a shortname by comparing the fullname with `dir_name`. +/// +/// @param full_path The full path of the file. +/// @param dir_name The directory to shorten relative to. +/// @return +/// - Pointer into `full_path` if shortened. +/// - NULL if no shorter name is possible. +char_u *path_shorten_fname(char_u *full_path, char_u *dir_name); + int expand_wildcards_eval(char_u **pat, int *num_file, char_u ***file, int flags); int expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u * |