]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tools/nolibc: string: Remove the `_nolibc_memcpy_up()` function
authorAmmar Faizi <ammarfaizi2@gnuweeb.org>
Sat, 2 Sep 2023 13:35:05 +0000 (20:35 +0700)
committerThomas Weißschuh <linux@weissschuh.net>
Thu, 12 Oct 2023 19:14:03 +0000 (21:14 +0200)
This function is only called by memcpy(), there is no real reason to
have this wrapper. Delete this function and move the code to memcpy()
directly.

Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Reviewed-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
tools/include/nolibc/string.h

index 22dcb3f566baeefe64f4f78c5fd04c3c79983452..a01c69dd495f550c42a4186c5e6c717f8e893d78 100644 (file)
@@ -27,18 +27,6 @@ int memcmp(const void *s1, const void *s2, size_t n)
        return c1;
 }
 
-static __attribute__((unused))
-void *_nolibc_memcpy_up(void *dst, const void *src, size_t len)
-{
-       size_t pos = 0;
-
-       while (pos < len) {
-               ((char *)dst)[pos] = ((const char *)src)[pos];
-               pos++;
-       }
-       return dst;
-}
-
 #ifndef NOLIBC_ARCH_HAS_MEMMOVE
 /* might be ignored by the compiler without -ffreestanding, then found as
  * missing.
@@ -70,7 +58,13 @@ void *memmove(void *dst, const void *src, size_t len)
 __attribute__((weak,unused,section(".text.nolibc_memcpy")))
 void *memcpy(void *dst, const void *src, size_t len)
 {
-       return _nolibc_memcpy_up(dst, src, len);
+       size_t pos = 0;
+
+       while (pos < len) {
+               ((char *)dst)[pos] = ((const char *)src)[pos];
+               pos++;
+       }
+       return dst;
 }
 #endif /* #ifndef NOLIBC_ARCH_HAS_MEMCPY */