diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-02-05 01:11:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-05 01:11:06 +0100 |
commit | bb2f36d038ccb375249a078997f68840ddcc66ef (patch) | |
tree | a080d374a6b38607806ca553d00b2d3e8b590c36 /src/nvim/path.c | |
parent | 3d3b1641d0cae3244c09d4602ab96d290dd0928a (diff) | |
parent | 18127f64c421a2c4da100a9e40d49c31a9a5170a (diff) | |
download | rneovim-bb2f36d038ccb375249a078997f68840ddcc66ef.tar.gz rneovim-bb2f36d038ccb375249a078997f68840ddcc66ef.tar.bz2 rneovim-bb2f36d038ccb375249a078997f68840ddcc66ef.zip |
Merge #6038 from justinmk/win32-executable
win: executable()
Diffstat (limited to 'src/nvim/path.c')
-rw-r--r-- | src/nvim/path.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c index 374d72ddd3..ea06fb8dde 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -995,12 +995,10 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern) ga_remove_duplicate_strings(gap); } -/* - * Return the end of the directory name, on the first path - * separator: - * "/path/file", "/path/dir/", "/path//dir", "/file" - * ^ ^ ^ ^ - */ +/// Return the end of the directory name, on the first path +/// separator: +/// "/path/file", "/path/dir/", "/path//dir", "/file" +/// ^ ^ ^ ^ char_u *gettail_dir(const char_u *fname) { const char_u *dir_end = fname; @@ -2131,17 +2129,12 @@ int append_path(char *path, const char *to_append, size_t max_len) size_t current_length = strlen(path); size_t to_append_length = strlen(to_append); - // Do not append empty strings. - if (to_append_length == 0) { - return OK; - } - - // Do not append a dot. - if (STRCMP(to_append, ".") == 0) { + // Do not append empty string or a dot. + if (to_append_length == 0 || strcmp(to_append, ".") == 0) { return OK; } - // Glue both paths with a slash. + // Combine the path segments, separated by a slash. if (current_length > 0 && !vim_ispathsep_nocolon(path[current_length-1])) { current_length += 1; // Count the trailing slash. @@ -2150,7 +2143,7 @@ int append_path(char *path, const char *to_append, size_t max_len) return FAIL; } - STRCAT(path, PATHSEPSTR); + xstrlcat(path, PATHSEPSTR, max_len); } // +1 for the NUL at the end. @@ -2158,7 +2151,7 @@ int append_path(char *path, const char *to_append, size_t max_len) return FAIL; } - STRCAT(path, to_append); + xstrlcat(path, to_append, max_len); return OK; } |