From 81a14439417552324ec6ca71f65ddf8e7cdd51c7 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Tue, 5 Feb 2019 17:35:12 -0200 Subject: wcsmbs: optimize wcscat This patch rewrites wcscat using wcslen and wcscpy. This is similar to the optimization done on strcat by 6e46de42fe. The strcpy changes are mainly to add the internal alias to avoid PLT calls. Checked on x86_64-linux-gnu and a build against the affected architectures. * include/wchar.h (__wcscpy): New prototype. * sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c (__wcscpy): Route internal symbol to generic implementation. * sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c (wcscpy): Add internal __wcscpy alias. * sysdeps/powerpc/powerpc64/multiarch/wcscpy.c (wcscpy): Likewise. * sysdeps/s390/wcscpy.c (wcscpy): Likewise. * sysdeps/x86_64/multiarch/wcscpy.c (wcscpy): Likewise. * wcsmbs/wcscpy.c (wcscpy): Add * sysdeps/x86_64/multiarch/wcscpy-c.c (WCSCPY): Adjust macro to use generic implementation. * wcsmbs/wcscat.c (wcscat): Rewrite using wcslen and wcscpy. --- include/wchar.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/wchar.h b/include/wchar.h index 614073bcb3..2cb44954fc 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -182,6 +182,10 @@ extern size_t __wcsnrtombs (char *__restrict __dst, size_t __nwc, size_t __len, __mbstate_t *__restrict __ps) attribute_hidden; +extern wchar_t *__wcscpy (wchar_t *__restrict __dest, + const wchar_t *__restrict __src) + attribute_hidden __nonnull ((1, 2)); +libc_hidden_proto (__wcscpy) extern wchar_t *__wcsncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n); extern wchar_t *__wcpcpy (wchar_t *__dest, const wchar_t *__src); -- cgit v1.2.1