Remove wcsndup and wcslcpy

We no longer use these anywhere.
This commit is contained in:
Fabian Homborg
2022-01-07 18:43:31 +01:00
parent 753f29df4c
commit 03c188086c
4 changed files with 0 additions and 73 deletions

View File

@@ -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<wchar_t *>(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 <Todd.Miller@courtesan.com>
*
* 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); }