diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 2e2d5e567..b685a5c0f 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -128,9 +128,7 @@ check_cxx_symbol_exists(eventfd sys/eventfd.h HAVE_EVENTFD) check_cxx_symbol_exists(pipe2 unistd.h HAVE_PIPE2) check_cxx_symbol_exists(wcscasecmp wchar.h HAVE_WCSCASECMP) check_cxx_symbol_exists(wcsdup wchar.h HAVE_WCSDUP) -check_cxx_symbol_exists(wcslcpy wchar.h HAVE_WCSLCPY) check_cxx_symbol_exists(wcsncasecmp wchar.h HAVE_WCSNCASECMP) -check_cxx_symbol_exists(wcsndup wchar.h HAVE_WCSNDUP) # These are for compatibility with Solaris 10, which places the following # in the std namespace. diff --git a/config_cmake.h.in b/config_cmake.h.in index 73571fc04..50caf6231 100644 --- a/config_cmake.h.in +++ b/config_cmake.h.in @@ -100,15 +100,9 @@ /* Define to 1 if you have the `wcsdup' function. */ #cmakedefine HAVE_WCSDUP 1 -/* Define to 1 if you have the `wcslcpy' function. */ -#cmakedefine HAVE_WCSLCPY 1 - /* Define to 1 if you have the `wcsncasecmp' function. */ #cmakedefine HAVE_WCSNCASECMP 1 -/* Define to 1 if you have the `wcsndup' function. */ -#cmakedefine HAVE_WCSNDUP 1 - /* Define to 1 if you have the `wcstod_l' function. */ #cmakedefine HAVE_WCSTOD_L 1 diff --git a/src/fallback.cpp b/src/fallback.cpp index d0c1c2e63..8746e1243 100644 --- a/src/fallback.cpp +++ b/src/fallback.cpp @@ -125,57 +125,6 @@ int wcsncasecmp(const wchar_t *a, const wchar_t *b, size_t n) { #endif #endif -#ifndef HAVE_WCSNDUP -wchar_t *wcsndup(const wchar_t *in, size_t c) { - auto res = static_cast(malloc(sizeof(wchar_t) * (c + 1))); - if (res == nullptr) { - return nullptr; - } - wcslcpy(res, in, c + 1); - return res; -} -#endif - -#ifndef HAVE_WCSLCPY -/*$OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $*/ - -/* - * Copyright (c) 1998 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz) { - wchar_t *d = dst; - const wchar_t *s = src; - size_t n = siz; - - // Copy as many bytes as will fit. - if (n != 0 && --n != 0) { - do { - if ((*d++ = *s++) == 0) break; - } while (--n != 0); - } - - // Not enough room in dst, add NUL and traverse rest of src. - if (n == 0) { - if (siz != 0) *d = '\0'; // NUL-terminate dst - while (*s++) - ; // ignore rest of src - } - return s - src - 1; // count does not include NUL -} -#endif - #if HAVE_GETTEXT char *fish_gettext(const char *msgid) { return gettext(msgid); } diff --git a/src/fallback.h b/src/fallback.h index 7a212c687..043eea2d7 100644 --- a/src/fallback.h +++ b/src/fallback.h @@ -109,20 +109,6 @@ int wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n); #endif #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); -#endif - -#ifndef HAVE_WCSLCPY -/// Copy src to string dst of size siz. At most siz-1 characters will be copied. Always NUL -/// terminates (unless siz == 0). Returns std::wcslen(src); if retval >= siz, truncation occurred. -/// -/// This is the OpenBSD strlcpy function, modified for wide characters, and renamed to reflect this -/// change. -size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz); -#endif - // autoconf may fail to detect gettext (645), so don't define a function call gettext or we'll get // build errors.