mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
remove one of the wrealpath() definitions
It is believed there are no longer any platforms we support that do not support passing NULL as the second argument to realpath(). So rather than duplicating the logic to get reasonable behavior from our wrealpath() wrapper simply remove the redundant implementation.
This commit is contained in:
parent
f7f39b8c90
commit
7fd3079bb6
2 changed files with 0 additions and 63 deletions
39
configure.ac
39
configure.ac
|
@ -320,45 +320,6 @@ fi
|
|||
# features that Autoconf doesn't tell us about
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# Check if realpath accepts null for its second argument
|
||||
#
|
||||
|
||||
AC_MSG_CHECKING([if realpath accepts null for its second argument])
|
||||
AC_RUN_IFELSE(
|
||||
[
|
||||
AC_LANG_PROGRAM(
|
||||
[
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
],
|
||||
[
|
||||
int status;
|
||||
char *res;
|
||||
res = realpath( "somefile", 0 );
|
||||
status = !(res != 0 || errno == ENOENT);
|
||||
exit( status );
|
||||
]
|
||||
)
|
||||
],
|
||||
[have_realpath_null=yes],
|
||||
[have_realpath_null=no]
|
||||
)
|
||||
|
||||
if test "$have_realpath_null" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(
|
||||
[HAVE_REALPATH_NULL],
|
||||
[1],
|
||||
[Define to 1 if realpath accepts null for its second argument.]
|
||||
)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Check if struct winsize and TIOCGWINSZ exist
|
||||
#
|
||||
|
|
|
@ -332,8 +332,6 @@ void safe_perror(const char *message) {
|
|||
errno = err;
|
||||
}
|
||||
|
||||
#ifdef HAVE_REALPATH_NULL
|
||||
|
||||
wchar_t *wrealpath(const wcstring &pathname, wchar_t *resolved_path) {
|
||||
if (pathname.size() == 0) return NULL;
|
||||
|
||||
|
@ -389,28 +387,6 @@ wchar_t *wrealpath(const wcstring &pathname, wchar_t *resolved_path) {
|
|||
return wcsdup(wreal_path.c_str());
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
wchar_t *wrealpath(const wcstring &pathname, wchar_t *resolved_path) {
|
||||
cstring tmp = wcs2string(pathname);
|
||||
char narrow_buff[PATH_MAX];
|
||||
char *narrow_res = realpath(tmp.c_str(), narrow_buff);
|
||||
wchar_t *res;
|
||||
|
||||
if (!narrow_res) return 0;
|
||||
|
||||
const wcstring wide_res = str2wcstring(narrow_res);
|
||||
if (resolved_path) {
|
||||
wcslcpy(resolved_path, wide_res.c_str(), PATH_MAX);
|
||||
res = resolved_path;
|
||||
} else {
|
||||
res = wcsdup(wide_res.c_str());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
wcstring wdirname(const wcstring &path) {
|
||||
char *tmp = wcs2str(path.c_str());
|
||||
char *narrow_res = dirname(tmp);
|
||||
|
|
Loading…
Reference in a new issue