Merge "Take a couple of wcs MTE patches from upstream FreeBSD."
This commit is contained in:
commit
888903aa8a
2 changed files with 9 additions and 5 deletions
|
@ -1,4 +1,6 @@
|
||||||
/*
|
/*-
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*
|
||||||
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -33,7 +35,7 @@
|
||||||
__RCSID("$NetBSD: wcslcat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
|
__RCSID("$NetBSD: wcslcat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
#endif
|
#endif
|
||||||
__FBSDID("$FreeBSD$");
|
__FBSDID("$FreeBSD: head/lib/libc/string/wcslcat.c 326193 2017-11-25 17:12:48Z pfg $");
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
@ -54,7 +56,7 @@ wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
|
||||||
size_t dlen;
|
size_t dlen;
|
||||||
|
|
||||||
/* Find the end of dst and adjust bytes left but don't go past end */
|
/* Find the end of dst and adjust bytes left but don't go past end */
|
||||||
while (*d != '\0' && n-- != 0)
|
while (n-- != 0 && *d != '\0')
|
||||||
d++;
|
d++;
|
||||||
dlen = d - dst;
|
dlen = d - dst;
|
||||||
n = siz - dlen;
|
n = siz - dlen;
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/*-
|
/*-
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*
|
||||||
* Copyright (c)1999 Citrus Project,
|
* Copyright (c)1999 Citrus Project,
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -32,7 +34,7 @@
|
||||||
__RCSID("$NetBSD: wcsncat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
|
__RCSID("$NetBSD: wcsncat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
#endif
|
#endif
|
||||||
__FBSDID("$FreeBSD$");
|
__FBSDID("$FreeBSD: head/lib/libc/string/wcsncat.c 326193 2017-11-25 17:12:48Z pfg $");
|
||||||
|
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
|
@ -48,7 +50,7 @@ wcsncat(wchar_t * __restrict s1, const wchar_t * __restrict s2, size_t n)
|
||||||
p++;
|
p++;
|
||||||
q = p;
|
q = p;
|
||||||
r = s2;
|
r = s2;
|
||||||
while (*r && n) {
|
while (n && *r) {
|
||||||
*q++ = *r++;
|
*q++ = *r++;
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue