mirror of
https://github.com/neovim/neovim.git
synced 2026-01-22 13:12:54 +10:00
Move definition of helper function below their usage.
This commit is contained in:
committed by
Thiago de Arruda
parent
9fc67aa7a3
commit
b552a202f4
33
src/os/fs.c
33
src/os/fs.c
@@ -193,6 +193,23 @@ int mch_isdir(char_u *name)
|
||||
}
|
||||
|
||||
static int is_executable(char_u *name);
|
||||
static int is_executable_in_path(char_u *name);
|
||||
|
||||
/*
|
||||
* Return 1 if "name" can be found in $PATH and executed, 0 if not.
|
||||
* Return -1 if unknown.
|
||||
*/
|
||||
int mch_can_exe(char_u *name)
|
||||
{
|
||||
/* If it's an absolute or relative path don't need to use $PATH. */
|
||||
if (mch_is_absolute_path(name) ||
|
||||
(name[0] == '.' && (name[1] == '/' ||
|
||||
(name[1] == '.' && name[2] == '/')))) {
|
||||
return is_executable(name);
|
||||
}
|
||||
|
||||
return is_executable_in_path(name);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return 1 if "name" is an executable file, 0 if not or it doesn't exist.
|
||||
@@ -258,19 +275,3 @@ static int is_executable_in_path(char_u *name)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return 1 if "name" can be found in $PATH and executed, 0 if not.
|
||||
* Return -1 if unknown.
|
||||
*/
|
||||
int mch_can_exe(char_u *name)
|
||||
{
|
||||
/* If it's an absolute or relative path don't need to use $PATH. */
|
||||
if (mch_is_absolute_path(name) ||
|
||||
(name[0] == '.' && (name[1] == '/' ||
|
||||
(name[1] == '.' && name[2] == '/')))) {
|
||||
return is_executable(name);
|
||||
}
|
||||
|
||||
return is_executable_in_path(name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user