aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/string/strncpy.c
diff options
context:
space:
mode:
authorLeandro Lupori <luporl@FreeBSD.org>2020-01-15 19:53:03 +0000
committerLeandro Lupori <luporl@FreeBSD.org>2020-01-15 19:53:03 +0000
commit181e35008cfbe18b2cfccb08d349415d8c21d8b6 (patch)
treeb45061f4afc62ad53a6b4b5871098055830ae5a6 /lib/libc/string/strncpy.c
parent075fb85f0904d5a9ddb59d03f78a5dcb4237903d (diff)
[PPC64] strncpy optimization
Assembly optimization of strncpy for PowerPC64, using double words instead of bytes to copy strings. Submitted by: Leonardo Bianconi <leonardo.bianconi_eldorado.org.br> (original version) Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D15369
Notes
svn path=/head/; revision=356766
Diffstat (limited to 'lib/libc/string/strncpy.c')
-rw-r--r--lib/libc/string/strncpy.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libc/string/strncpy.c b/lib/libc/string/strncpy.c
index 3c02ccae41d8..2ffce161c5c5 100644
--- a/lib/libc/string/strncpy.c
+++ b/lib/libc/string/strncpy.c
@@ -44,8 +44,17 @@ __FBSDID("$FreeBSD$");
* Copy src to dst, truncating or null-padding to always copy n bytes.
* Return dst.
*/
+#ifdef WEAK_STRNCPY
+__weak_reference(__strncpy, strncpy);
+#endif
+
char *
-strncpy(char * __restrict dst, const char * __restrict src, size_t n)
+#ifdef WEAK_STRNCPY
+__strncpy
+#else
+strncpy
+#endif
+(char * __restrict dst, const char * __restrict src, size_t n)
{
if (n != 0) {
char *d = dst;