Page MenuHomeFreeBSD

D46292.diff
No OneTemporary

D46292.diff

diff --git a/lib/libc/aarch64/string/Makefile.inc b/lib/libc/aarch64/string/Makefile.inc
--- a/lib/libc/aarch64/string/Makefile.inc
+++ b/lib/libc/aarch64/string/Makefile.inc
@@ -28,7 +28,8 @@
strcat.c \
strlcpy.S \
strncmp.S \
- memccpy.S
+ memccpy.S \
+ strncat.c
#
# Add the above functions. Generate an asm file that includes the needed
diff --git a/lib/libc/aarch64/string/strncat.c b/lib/libc/aarch64/string/strncat.c
new file mode 100644
--- /dev/null
+++ b/lib/libc/aarch64/string/strncat.c
@@ -0,0 +1,29 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2023 Robert Clausecker
+ */
+
+#include <sys/cdefs.h>
+
+#include <string.h>
+
+void *__memccpy(void *restrict, const void *restrict, int, size_t);
+
+char *
+strncat(char *dest, const char *src, size_t n)
+{
+ size_t len;
+ char *endptr;
+
+ len = strlen(dest);
+ endptr = __memccpy(dest + len, src, '\0', n);
+
+ /* avoid an extra branch */
+ if (endptr == NULL)
+ endptr = dest + len + n + 1;
+
+ endptr[-1] = '\0';
+
+ return (dest);
+}

File Metadata

Mime Type
text/plain
Expires
Wed, Jun 24, 6:34 AM (1 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34260389
Default Alt Text
D46292.diff (1 KB)

Event Timeline