From 69e6fe89fa9baafeca3e3515bb50897cd8ee7c35 Mon Sep 17 00:00:00 2001 From: Kacper Date: Mon, 15 Dec 2025 18:24:54 +0100 Subject: Add getauxval and cleanup libc startup --- lib/libc/string/memcpy.c | 11 +++++------ lib/libc/string/strcoll.c | 3 +-- lib/libc/string/strerror.c | 7 ++----- lib/libc/string/strxfrm.c | 7 ++----- 4 files changed, 10 insertions(+), 18 deletions(-) (limited to 'lib/libc/string') diff --git a/lib/libc/string/memcpy.c b/lib/libc/string/memcpy.c index 46e24e42..f87d95cd 100644 --- a/lib/libc/string/memcpy.c +++ b/lib/libc/string/memcpy.c @@ -1,7 +1,7 @@ -#include // for EINVAL, ERANGE -#include // for __weak -#include // for NULL, errno_t -#include // for rsize_t, memcpy, size_t, memcpy_s +#include // for EINVAL, ERANGE +#include // for NULL, errno_t +#include // for rsize_t, memcpy, size_t, memcpy_s +#include __weak void *memcpy(void *restrict s1, const void *restrict s2, size_t n); @@ -17,8 +17,7 @@ void *memcpy(void *restrict s1, const void *restrict s2, size_t n) return s1; } -errno_t memcpy_s(void *restrict dest, rsize_t destsz, const void *restrict src, - rsize_t count) +errno_t memcpy_s(void *restrict dest, rsize_t destsz, const void *restrict src, rsize_t count) { if (dest == NULL || src == NULL) { if (dest != NULL && destsz > 0) { diff --git a/lib/libc/string/strcoll.c b/lib/libc/string/strcoll.c index e862bb11..2a4a3473 100644 --- a/lib/libc/string/strcoll.c +++ b/lib/libc/string/strcoll.c @@ -1,7 +1,6 @@ -#include "features.h" // for __weak - #include // for __unused #include // for strcmp, locale_t, strcoll, strcoll_l +#include int strcoll(const char *s1, const char *s2) { diff --git a/lib/libc/string/strerror.c b/lib/libc/string/strerror.c index 62bcea76..b96884ea 100644 --- a/lib/libc/string/strerror.c +++ b/lib/libc/string/strerror.c @@ -1,9 +1,7 @@ -#include "features.h" // for __weak - -#include "stddef.h" #include // for ERANGE, E2BIG, EACCES, EADDRINUSE, EADDRNOTAVAIL #include // for __unused #include // for memcpy, size_t, strerror, strlen, locale_t +#include char *strerror(int errnum) { @@ -105,8 +103,7 @@ char *strerror(int errnum) [EKEYREJECTED] = "Key was rejected by service", }; - if (errnum < 0 || (size_t)errnum >= sizeof(table) / sizeof(table[0]) || - !table[errnum]) { + if (errnum < 0 || (size_t)errnum >= sizeof(table) / sizeof(table[0]) || !table[errnum]) { errno = EINVAL; return NULL; } diff --git a/lib/libc/string/strxfrm.c b/lib/libc/string/strxfrm.c index ae51f984..ddfe8315 100644 --- a/lib/libc/string/strxfrm.c +++ b/lib/libc/string/strxfrm.c @@ -1,7 +1,5 @@ -#include "features.h" // for __weak - -#include // for __unused #include // for size_t, strlcpy, strlen, strxfrm, locale_t +#include size_t strxfrm(char *restrict s1, const char *restrict s2, size_t n) { @@ -13,8 +11,7 @@ size_t strxfrm(char *restrict s1, const char *restrict s2, size_t n) return len; } -__weak size_t strxfrm_l(char *restrict s1, const char *restrict s2, size_t n, - locale_t __unused locale) +__weak size_t strxfrm_l(char *restrict s1, const char *restrict s2, size_t n, locale_t __unused locale) { return strxfrm(s1, s2, n); } -- cgit v1.2.3