From db18449f4cdc190c74a2ba3228fbd1e0ca467154 Mon Sep 17 00:00:00 2001 From: David Adam Date: Sun, 15 May 2016 23:19:27 +0000 Subject: fallback: drop fallbacks for C99/C++0x wide character functions Drops configure check for wcsdup, wcslen, wcscasecmp, wcsncasecmp, wcwidth, wcswidth, wcstok, fputwc, fgetwc, and wcstol. Drop the fallback implementations of these on non-Snow Leopard platforms. Work on #2999. --- src/fallback.h | 78 ---------------------------------------------------------- 1 file changed, 78 deletions(-) (limited to 'src/fallback.h') diff --git a/src/fallback.h b/src/fallback.h index 13caf0b3..97f49523 100644 --- a/src/fallback.h +++ b/src/fallback.h @@ -38,14 +38,6 @@ typedef int tputs_arg_t; typedef char tputs_arg_t; #endif -#ifndef SIGIO -#define SIGIO SIGUSR1 -#endif - -#ifndef SIGWINCH -#define SIGWINCH SIGUSR2 -#endif - #ifndef HAVE_WINSIZE /// Structure used to get the size of a terminal window. struct winsize { @@ -63,32 +55,6 @@ struct winsize { char *tparm_solaris_kludge(char *str, ...); #endif -#ifndef HAVE_FGETWC -// Fallback implementation of fgetwc. -wint_t fgetwc(FILE *stream); -#endif - -#ifndef HAVE_FPUTWC -// Fallback implementation of fputwc. -wint_t fputwc(wchar_t wc, FILE *stream); -#endif - -#ifndef HAVE_WCSTOK -/// Fallback implementation of wcstok. Uses code borrowed from glibc. -wchar_t *wcstok(wchar_t *wcs, const wchar_t *delim, wchar_t **ptr); -#endif - -#ifndef HAVE_WCWIDTH -/// Return the number of columns used by a character. This is a libc function, but the prototype for -/// this function is missing in some libc implementations. -/// -/// Fish has a fallback implementation in case the implementation is missing altogether. In locales -/// without a native wcwidth, Unicode is probably so broken that it isn't worth trying to implement -/// a real wcwidth. Therefore, the fallback wcwidth assumes any printing character takes up one -/// column and anything else uses 0 columns. -int wcwidth(wchar_t c); -#endif - /// On OS X, use weak linking for wcsdup and wcscasecmp. Weak linking allows you to call the /// function only if it exists at runtime. You can detect it by testing the function pointer against /// NULL. To avoid making the callers do that, redefine wcsdup to wcsdup_use_weak, and likewise with @@ -103,45 +69,8 @@ int wcsncasecmp_use_weak(const wchar_t *s1, const wchar_t *s2, size_t n); #define wcsdup(a) wcsdup_use_weak((a)) #define wcscasecmp(a, b) wcscasecmp_use_weak((a), (b)) #define wcsncasecmp(a, b, c) wcsncasecmp_use_weak((a), (b), (c)) - -#else - -#ifndef HAVE_WCSDUP -/// Create a duplicate string. Wide string version of strdup. Will automatically exit if out of -/// memory. -wchar_t *wcsdup(const wchar_t *in); -#endif - -#ifndef HAVE_WCSCASECMP -/// Case insensitive string compare function. Wide string version of strcasecmp. -/// -/// This implementation of wcscasecmp does not take into account esoteric locales where uppercase -/// and lowercase do not cleanly transform between each other. Hopefully this should be fine since -/// fish only uses this function with one of the strings supplied by fish and guaranteed to be a -/// sane, english word. Using wcscasecmp on a user-supplied string should be considered a bug. -int wcscasecmp(const wchar_t *a, const wchar_t *b); -#endif #endif //__APPLE__ -#ifndef HAVE_WCSLEN -/// Fallback for wclsen. Returns the length of the specified string. -size_t wcslen(const wchar_t *in); -#endif - -#ifndef HAVE_WCSNCASECMP -/// Case insensitive string compare function. Wide string version of strncasecmp. -/// -/// This implementation of wcsncasecmp does not take into account esoteric locales where uppercase -/// and lowercase do not cleanly transform between each other. Hopefully this should be fine since -/// fish only uses this function with one of the strings supplied by fish and guaranteed to be a -/// sane, english word. Using wcsncasecmp on a user-supplied string should be considered a bug. -int wcsncasecmp(const wchar_t *a, const wchar_t *b, size_t count); - -/// Returns a newly allocated wide character string wich is a copy of the string in, but of length c -/// or shorter. The returned string is always null terminated, and the null is not included in the -/// string length. -#endif - #ifndef HAVE_WCSNDUP /// Fallback for wcsndup function. Returns a copy of \c in, truncated to a maximum length of \c c. wchar_t *wcsndup(const wchar_t *in, size_t c); @@ -152,13 +81,6 @@ wchar_t *wcsndup(const wchar_t *in, size_t c); /// is exported. long convert_digit(wchar_t d, int base); -#ifndef HAVE_WCSTOL -/// Fallback implementation. Convert a wide character string to a number in the specified base. This -/// functions is the wide character string equivalent of strtol. For bases of 10 or lower, 0..9 are -/// used to represent numbers. For bases below 36, a-z and A-Z are used to represent numbers higher -/// than 9. Higher bases than 36 are not supported. -long wcstol(const wchar_t *nptr, wchar_t **endptr, int base); -#endif #ifndef HAVE_WCSLCAT /// Appends src to string dst of size siz (unlike wcsncat, siz is the full size of dst, not space /// left). At most siz-1 characters will be copied. Always NUL terminates (unless siz <= -- cgit v1.2.3