mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
fallback: check for existence of std:: namespace functions
Before defining fallback functions of wcsdup(), wcscasecmp() and
wcsncasecmp(), use the std:: namespace functions instead if they exist.
0019c12af3
fixed the build on Solaris 10, but broke it on Solaris 11.
This commit is contained in:
parent
db63be7909
commit
002757225a
3 changed files with 29 additions and 17 deletions
12
src/common.h
12
src/common.h
|
@ -858,18 +858,6 @@ static const wchar_t *enum_to_str(T enum_val, const enum_map<T> map[]) {
|
|||
return NULL;
|
||||
};
|
||||
|
||||
#if !defined(HAVE_WCSDUP) && defined(HAVE_STD__WCSDUP)
|
||||
using std::wcsdup;
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_WCSCASECMP) && defined(HAVE_STD__WCSCASECMP)
|
||||
using std::wcscasecmp;
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_WCSNCASECMP) && defined(HAVE_STD__WCSNCASECMP)
|
||||
using std::wcsncasecmp;
|
||||
#endif
|
||||
|
||||
void redirect_tty_output();
|
||||
|
||||
// Minimum allowed terminal size and default size if the detected size is not reasonable.
|
||||
|
|
|
@ -171,14 +171,20 @@ int wcsncasecmp(const wchar_t *a, const wchar_t *b, size_t n) {
|
|||
#endif // __DARWIN_C_LEVEL >= 200809L
|
||||
#else // __APPLE__
|
||||
|
||||
/// These functions are missing from Solaris 10
|
||||
#ifndef HAVE_WCSDUP
|
||||
#ifndef HAVE_STD__WCSDUP
|
||||
wchar_t *wcsdup(const wchar_t *in) { return wcsdup_fallback(in); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WCSCASECMP
|
||||
#ifndef HAVE_STD__WCSCASECMP
|
||||
int wcscasecmp(const wchar_t *a, const wchar_t *b) { return wcscasecmp_fallback(a, b); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WCSNCASECMP
|
||||
#ifndef HAVE_STD__WCSNCASECMP
|
||||
int wcsncasecmp(const wchar_t *a, const wchar_t *b, size_t n) {
|
||||
return wcsncasecmp_fallback(a, b, n);
|
||||
}
|
||||
|
@ -196,6 +202,8 @@ wchar_t *wcsndup(const wchar_t *in, size_t c) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
#ifndef HAVE_WCSLCPY
|
||||
/*$OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $*/
|
||||
|
||||
|
|
|
@ -89,16 +89,32 @@ wchar_t *wcsndup(const wchar_t *in, size_t c);
|
|||
#endif
|
||||
#else //__APPLE__
|
||||
|
||||
/// These functions are missing from Solaris 10
|
||||
/// These functions are missing from Solaris 10, and only accessible from
|
||||
/// Solaris 11 in the std:: namespace.
|
||||
#ifndef HAVE_WCSDUP
|
||||
#ifdef HAVE_STD__WCSDUP
|
||||
using std::wcsdup;
|
||||
#else
|
||||
wchar_t *wcsdup(const wchar_t *in);
|
||||
#endif
|
||||
#endif // HAVE_STD__WCSDUP
|
||||
#endif // HAVE_WCSDUP
|
||||
|
||||
#ifndef HAVE_WCSCASECMP
|
||||
#ifdef HAVE_STD__WCSCASECMP
|
||||
using std::wcscasecmp;
|
||||
#else
|
||||
int wcscasecmp(const wchar_t *a, const wchar_t *b);
|
||||
#endif
|
||||
#endif // HAVE_STD__WCSCASECMP
|
||||
#endif // HAVE_WCSCASECMP
|
||||
|
||||
#ifndef HAVE_WCSNCASECMP
|
||||
#ifdef HAVE_STD__WCSNCASECMP
|
||||
using std::wcsncasecmp;
|
||||
#else
|
||||
int wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n);
|
||||
#endif
|
||||
#endif // HAVE_STD__WCSNCASECMP
|
||||
#endif // HAVE_WCSNCASECMP
|
||||
|
||||
#ifndef HAVE_DIRFD
|
||||
#ifndef __XOPEN_OR_POSIX
|
||||
#define dirfd(d) (d->dd_fd)
|
||||
|
|
Loading…
Reference in a new issue