mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH v1] string.h: Unconditionally expose C23 functions
@ 2025-07-11 13:47 Alejandro Colomar
  2025-07-11 16:44 ` [musl] " A. Wilcox
  0 siblings, 1 reply; 6+ messages in thread
From: Alejandro Colomar @ 2025-07-11 13:47 UTC (permalink / raw)
  To: musl; +Cc: Alejandro Colomar

memccpy(3), strnlen(3), strdup(3), and strndup(3) are now specified by
ISO C, since C23.

Link: <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
 include/string.h | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/include/string.h b/include/string.h
index 83e2b946..723cfc42 100644
--- a/include/string.h
+++ b/include/string.h
@@ -26,6 +26,7 @@ extern "C" {
 
 void *memcpy (void *__restrict, const void *__restrict, size_t);
 void *memmove (void *, const void *, size_t);
+void *memccpy (void *__restrict, const void *__restrict, int, size_t);
 void *memset (void *, int, size_t);
 int memcmp (const void *, const void *, size_t);
 void *memchr (const void *, int, size_t);
@@ -36,6 +37,9 @@ char *strncpy (char *__restrict, const char *__restrict, size_t);
 char *strcat (char *__restrict, const char *__restrict);
 char *strncat (char *__restrict, const char *__restrict, size_t);
 
+char *strdup (const char *);
+char *strndup (const char *, size_t);
+
 int strcmp (const char *, const char *);
 int strncmp (const char *, const char *, size_t);
 
@@ -52,6 +56,7 @@ char *strstr (const char *, const char *);
 char *strtok (char *__restrict, const char *__restrict);
 
 size_t strlen (const char *);
+size_t strnlen (const char *, size_t);
 
 char *strerror (int);
 
@@ -66,9 +71,6 @@ char *strtok_r (char *__restrict, const char *__restrict, char **__restrict);
 int strerror_r (int, char *, size_t);
 char *stpcpy(char *__restrict, const char *__restrict);
 char *stpncpy(char *__restrict, const char *__restrict, size_t);
-size_t strnlen (const char *, size_t);
-char *strdup (const char *);
-char *strndup (const char *, size_t);
 char *strsignal(int);
 char *strerror_l (int, locale_t);
 int strcoll_l (const char *, const char *, locale_t);
@@ -76,11 +78,6 @@ size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
 void *memmem(const void *, size_t, const void *, size_t);
 #endif
 
-#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
- || defined(_BSD_SOURCE)
-void *memccpy (void *__restrict, const void *__restrict, int, size_t);
-#endif
-
 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 char *strsep(char **, const char *);
 size_t strlcat (char *, const char *, size_t);
-- 
2.50.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-07-11 22:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-11 13:47 [PATCH v1] string.h: Unconditionally expose C23 functions Alejandro Colomar
2025-07-11 16:44 ` [musl] " A. Wilcox
2025-07-11 17:04   ` Rich Felker
2025-07-11 18:55     ` Thorsten Glaser
2025-07-11 20:50       ` James Y Knight
2025-07-11 22:41         ` A. Wilcox

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).