From ccb6af064fe879dc8e213a582f7f938ad1972ae3 Mon Sep 17 00:00:00 2001 From: Rui Abreu Ferreira Date: Sun, 14 Aug 2016 15:18:09 +0100 Subject: path.c: Avoid code duplication for path separator checks --- src/nvim/path.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/path.c b/src/nvim/path.c index 80eeac9e74..a2617973b1 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -2191,8 +2191,9 @@ int path_is_absolute_path(const char_u *fname) { #ifdef WIN32 // A name like "d:/foo" and "//server/share" is absolute - return ((isalpha(fname[0]) && fname[1] == ':' && (fname[2] == '/' || fname[2] == '\\')) - || (fname[0] == fname[1] && (fname[0] == '/' || fname[0] == '\\'))); + return ((isalpha(fname[0]) && fname[1] == ':' + && vim_ispathsep_nocolon(fname[2])) + || (vim_ispathsep_nocolon(fname[0]) && fname[0] == fname[1])); #else // UNIX: This just checks if the file name starts with '/' or '~'. return *fname == '/' || *fname == '~'; -- cgit