mirror of
https://github.com/neovim/neovim.git
synced 2025-10-15 22:36:09 +00:00
os_can_exe: remove char_u
This commit is contained in:
@@ -239,10 +239,10 @@ int os_exepath(char *buffer, size_t *size)
|
||||
/// - is absolute.
|
||||
///
|
||||
/// @return `false` otherwise.
|
||||
bool os_can_exe(const char_u *name, char_u **abspath, bool use_path)
|
||||
bool os_can_exe(const char *name, char **abspath, bool use_path)
|
||||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
bool no_path = !use_path || path_is_absolute(name);
|
||||
bool no_path = !use_path || path_is_absolute((char_u *)name);
|
||||
// If the filename is "qualified" (relative or absolute) do not check $PATH.
|
||||
#ifdef WIN32
|
||||
no_path |= (name[0] == '.'
|
||||
@@ -255,11 +255,11 @@ bool os_can_exe(const char_u *name, char_u **abspath, bool use_path)
|
||||
|
||||
if (no_path) {
|
||||
#ifdef WIN32
|
||||
if (is_executable_ext((char *)name, abspath)) {
|
||||
if (is_executable_ext(name, abspath)) {
|
||||
#else
|
||||
// Must have path separator, cannot execute files in the current directory.
|
||||
if ((const char_u *)gettail_dir((const char *)name) != name
|
||||
&& is_executable((char *)name, abspath)) {
|
||||
if (gettail_dir(name) != name
|
||||
&& is_executable(name, abspath)) {
|
||||
#endif
|
||||
return true;
|
||||
} else {
|
||||
@@ -274,10 +274,10 @@ bool os_can_exe(const char_u *name, char_u **abspath, bool use_path)
|
||||
///
|
||||
/// @param[in] name Filename to check.
|
||||
/// @param[out,allocated] abspath Returns full exe path, if not NULL.
|
||||
static bool is_executable(const char *name, char_u **abspath)
|
||||
static bool is_executable(const char *name, char **abspath)
|
||||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
int32_t mode = os_getperm((const char *)name);
|
||||
int32_t mode = os_getperm(name);
|
||||
|
||||
if (mode < 0) {
|
||||
return false;
|
||||
@@ -295,7 +295,7 @@ static bool is_executable(const char *name, char_u **abspath)
|
||||
const bool ok = (r == 0);
|
||||
#endif
|
||||
if (ok && abspath != NULL) {
|
||||
*abspath = save_abs_path((char_u *)name);
|
||||
*abspath = save_abs_path(name);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@@ -304,7 +304,7 @@ static bool is_executable(const char *name, char_u **abspath)
|
||||
/// Checks if file `name` is executable under any of these conditions:
|
||||
/// - extension is in $PATHEXT and `name` is executable
|
||||
/// - result of any $PATHEXT extension appended to `name` is executable
|
||||
static bool is_executable_ext(char *name, char_u **abspath)
|
||||
static bool is_executable_ext(char *name, char **abspath)
|
||||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
const bool is_unix_shell = strstr((char *)path_tail(p_sh), "sh") != NULL;
|
||||
@@ -356,7 +356,7 @@ static bool is_executable_ext(char *name, char_u **abspath)
|
||||
/// @param[out] abspath Returns resolved executable path, if not NULL.
|
||||
///
|
||||
/// @return `true` if `name` is an executable inside `$PATH`.
|
||||
static bool is_executable_in_path(const char_u *name, char_u **abspath)
|
||||
static bool is_executable_in_path(const char *name, char **abspath)
|
||||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
const char *path_env = os_getenv("PATH");
|
||||
@@ -373,7 +373,7 @@ static bool is_executable_in_path(const char_u *name, char_u **abspath)
|
||||
char *path = xstrdup(path_env);
|
||||
#endif
|
||||
|
||||
size_t buf_len = STRLEN(name) + strlen(path) + 2;
|
||||
size_t buf_len = strlen(name) + strlen(path) + 2;
|
||||
char *buf = xmalloc(buf_len);
|
||||
|
||||
// Walk through all entries in $PATH to check if "name" exists there and
|
||||
@@ -385,7 +385,7 @@ static bool is_executable_in_path(const char_u *name, char_u **abspath)
|
||||
|
||||
// Combine the $PATH segment with `name`.
|
||||
STRLCPY(buf, p, e - p + 1);
|
||||
append_path(buf, (char *)name, buf_len);
|
||||
append_path(buf, name, buf_len);
|
||||
|
||||
#ifdef WIN32
|
||||
if (is_executable_ext(buf, abspath)) {
|
||||
|
Reference in New Issue
Block a user