summaryrefslogtreecommitdiff
path: root/lib/libc/string
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/string')
-rw-r--r--lib/libc/string/memchr.c3
-rw-r--r--lib/libc/string/memcmp.c2
-rw-r--r--lib/libc/string/memcpy.c3
-rw-r--r--lib/libc/string/memmem.c4
-rw-r--r--lib/libc/string/memmove.c2
-rw-r--r--lib/libc/string/stpncpy.c2
-rw-r--r--lib/libc/string/strcat.c2
-rw-r--r--lib/libc/string/strchr.c4
-rw-r--r--lib/libc/string/strcmp.c1
-rw-r--r--lib/libc/string/strcoll.c3
-rw-r--r--lib/libc/string/strcpy.c2
-rw-r--r--lib/libc/string/strcspn.c4
-rw-r--r--lib/libc/string/strdup.c4
-rw-r--r--lib/libc/string/strerror.c4
-rw-r--r--lib/libc/string/strlen.c3
-rw-r--r--lib/libc/string/strncmp.c2
-rw-r--r--lib/libc/string/strncpy.c2
-rw-r--r--lib/libc/string/strndup.c4
-rw-r--r--lib/libc/string/strpbrk.c1
-rw-r--r--lib/libc/string/strrchr.c1
-rw-r--r--lib/libc/string/strspn.c4
-rw-r--r--lib/libc/string/strstr.c1
-rw-r--r--lib/libc/string/strtok.c4
-rw-r--r--lib/libc/string/strtok_r.c4
-rw-r--r--lib/libc/string/strxfrm.c4
25 files changed, 46 insertions, 24 deletions
diff --git a/lib/libc/string/memchr.c b/lib/libc/string/memchr.c
index 230e042f..f13a2a2c 100644
--- a/lib/libc/string/memchr.c
+++ b/lib/libc/string/memchr.c
@@ -1,4 +1,5 @@
-#include <stddef.h> // for NULL, size_t
+#include <stddef.h> // for NULL
+#include <string.h> // for memchr, size_t
void *memchr(const void *s, int c, size_t n)
{
diff --git a/lib/libc/string/memcmp.c b/lib/libc/string/memcmp.c
index da1766c4..23a18392 100644
--- a/lib/libc/string/memcmp.c
+++ b/lib/libc/string/memcmp.c
@@ -1,4 +1,4 @@
-#include <stddef.h> // for size_t
+#include <string.h> // for memcmp, size_t
int memcmp(const void *s1, const void *s2, size_t n)
{
diff --git a/lib/libc/string/memcpy.c b/lib/libc/string/memcpy.c
index 8af4577c..46e24e42 100644
--- a/lib/libc/string/memcpy.c
+++ b/lib/libc/string/memcpy.c
@@ -1,6 +1,7 @@
#include <errno.h> // for EINVAL, ERANGE
#include <features.h> // for __weak
-#include <string.h> // for rsize_t, NULL, memcpy, size_t, errno_t, memcpy_s
+#include <stddef.h> // for NULL, errno_t
+#include <string.h> // for rsize_t, memcpy, size_t, memcpy_s
__weak void *memcpy(void *restrict s1, const void *restrict s2, size_t n);
diff --git a/lib/libc/string/memmem.c b/lib/libc/string/memmem.c
index b30a700a..4f55cf41 100644
--- a/lib/libc/string/memmem.c
+++ b/lib/libc/string/memmem.c
@@ -1,4 +1,6 @@
-#include <string.h> // for memcmp, size_t, NULL, memmem
+#include "stddef.h" // for NULL
+
+#include <string.h> // for memcmp, size_t, memmem
void *memmem(const void *haystack, size_t haystacklen, const void *needle,
size_t needlelen)
diff --git a/lib/libc/string/memmove.c b/lib/libc/string/memmove.c
index db83694f..c4fe3635 100644
--- a/lib/libc/string/memmove.c
+++ b/lib/libc/string/memmove.c
@@ -1,5 +1,5 @@
-#include <stddef.h> // for size_t
#include <stdint.h> // for uint8_t, uintptr_t
+#include <string.h> // for size_t, memmove
void *memmove(void *dst, const void *src, size_t n)
{
diff --git a/lib/libc/string/stpncpy.c b/lib/libc/string/stpncpy.c
index 1afa59fc..331e8dc7 100644
--- a/lib/libc/string/stpncpy.c
+++ b/lib/libc/string/stpncpy.c
@@ -1,4 +1,4 @@
-#include <stddef.h> // for size_t
+#include <string.h> // for strncpy, size_t
char *strncpy(char *restrict s1, const char *restrict s2, size_t n)
{
diff --git a/lib/libc/string/strcat.c b/lib/libc/string/strcat.c
index 6caf8c78..f7267f00 100644
--- a/lib/libc/string/strcat.c
+++ b/lib/libc/string/strcat.c
@@ -1,3 +1,5 @@
+#include <string.h> // for strcat
+
char *strcat(char *restrict s1, const char *restrict s2)
{
char *d = s1;
diff --git a/lib/libc/string/strchr.c b/lib/libc/string/strchr.c
index 06fb51bc..01b2589a 100644
--- a/lib/libc/string/strchr.c
+++ b/lib/libc/string/strchr.c
@@ -1,4 +1,6 @@
-#include <string.h> // for strchr, NULL
+#include "stddef.h" // for NULL
+
+#include <string.h> // for strchr
char *strchr(const char *s, int c)
{
diff --git a/lib/libc/string/strcmp.c b/lib/libc/string/strcmp.c
index e3e5ca03..698aba62 100644
--- a/lib/libc/string/strcmp.c
+++ b/lib/libc/string/strcmp.c
@@ -1,4 +1,5 @@
#include <stddef.h> // for NULL
+#include <string.h> // for strcmp
int strcmp(const char *s1, const char *s2)
{
diff --git a/lib/libc/string/strcoll.c b/lib/libc/string/strcoll.c
index 7a1502f0..e862bb11 100644
--- a/lib/libc/string/strcoll.c
+++ b/lib/libc/string/strcoll.c
@@ -1,8 +1,7 @@
#include "features.h" // for __weak
#include <libc.h> // for __unused
-#include <locale.h> // for locale_t
-#include <string.h> // for strcmp, strcoll, strcoll_l
+#include <string.h> // for strcmp, locale_t, strcoll, strcoll_l
int strcoll(const char *s1, const char *s2)
{
diff --git a/lib/libc/string/strcpy.c b/lib/libc/string/strcpy.c
index 8e1dab69..eef2a5e4 100644
--- a/lib/libc/string/strcpy.c
+++ b/lib/libc/string/strcpy.c
@@ -1,3 +1,5 @@
+#include <string.h> // for strcpy
+
char *strcpy(char *restrict s1, const char *restrict s2)
{
char *p = s1;
diff --git a/lib/libc/string/strcspn.c b/lib/libc/string/strcspn.c
index 4efb38ae..bc377586 100644
--- a/lib/libc/string/strcspn.c
+++ b/lib/libc/string/strcspn.c
@@ -1,4 +1,6 @@
-#include <string.h> // for size_t, strchr, strcspn, NULL
+#include "stddef.h" // for NULL
+
+#include <string.h> // for size_t, strchr, strcspn
size_t strcspn(const char *s1, const char *s2)
{
diff --git a/lib/libc/string/strdup.c b/lib/libc/string/strdup.c
index 97b5d712..198b62cc 100644
--- a/lib/libc/string/strdup.c
+++ b/lib/libc/string/strdup.c
@@ -1,4 +1,6 @@
-#include <stdlib.h> // for NULL, malloc
+#include "stddef.h" // for NULL
+
+#include <stdlib.h> // for malloc
#include <string.h> // for memcpy, strlen, size_t, strdup
char *strdup(const char *s)
diff --git a/lib/libc/string/strerror.c b/lib/libc/string/strerror.c
index e7800d08..c0a73146 100644
--- a/lib/libc/string/strerror.c
+++ b/lib/libc/string/strerror.c
@@ -1,10 +1,8 @@
-#include "__stdio.h" // for size_t
#include "features.h" // for __weak
#include <errno.h> // for ERANGE, E2BIG, EACCES, EADDRINUSE, EADDRNOTAVAIL
#include <libc.h> // for __unused
-#include <locale.h> // for locale_t
-#include <string.h> // for memcpy, strerror, strlen, strerror_l, strerror_r
+#include <string.h> // for memcpy, size_t, strerror, strlen, locale_t
char *strerror(int errnum)
{
diff --git a/lib/libc/string/strlen.c b/lib/libc/string/strlen.c
index 6371b588..a7e30a49 100644
--- a/lib/libc/string/strlen.c
+++ b/lib/libc/string/strlen.c
@@ -1,4 +1,5 @@
-#include <stddef.h> // for size_t, NULL
+#include <stddef.h> // for NULL
+#include <string.h> // for size_t, strlen
size_t strlen(const char *str)
{
diff --git a/lib/libc/string/strncmp.c b/lib/libc/string/strncmp.c
index 1675890a..8290a95c 100644
--- a/lib/libc/string/strncmp.c
+++ b/lib/libc/string/strncmp.c
@@ -1,4 +1,4 @@
-#include <stddef.h> // for size_t
+#include <string.h> // for strncmp, size_t
int strncmp(const char *s1, const char *s2, size_t n)
{
diff --git a/lib/libc/string/strncpy.c b/lib/libc/string/strncpy.c
index b0541b44..720591ea 100644
--- a/lib/libc/string/strncpy.c
+++ b/lib/libc/string/strncpy.c
@@ -1,4 +1,4 @@
-#include <stddef.h> // for size_t
+#include <string.h> // for strncpy, size_t
char *strncpy(char *restrict s1, const char *restrict s2, size_t n)
{
diff --git a/lib/libc/string/strndup.c b/lib/libc/string/strndup.c
index 318561ca..18d1a718 100644
--- a/lib/libc/string/strndup.c
+++ b/lib/libc/string/strndup.c
@@ -1,4 +1,6 @@
-#include <stdlib.h> // for NULL, malloc
+#include "stddef.h" // for NULL
+
+#include <stdlib.h> // for malloc
#include <string.h> // for memcpy, size_t, strndup
char *strndup(const char *s, size_t size)
diff --git a/lib/libc/string/strpbrk.c b/lib/libc/string/strpbrk.c
index a03bb31a..d46019b6 100644
--- a/lib/libc/string/strpbrk.c
+++ b/lib/libc/string/strpbrk.c
@@ -1,4 +1,5 @@
#include <stddef.h> // for NULL
+#include <string.h> // for strpbrk
char *strpbrk(const char *s1, const char *s2)
{
diff --git a/lib/libc/string/strrchr.c b/lib/libc/string/strrchr.c
index 5d66035e..863e5ca0 100644
--- a/lib/libc/string/strrchr.c
+++ b/lib/libc/string/strrchr.c
@@ -1,4 +1,5 @@
#include <stddef.h> // for NULL
+#include <string.h> // for strrchr
char *strrchr(const char *s, int c)
{
diff --git a/lib/libc/string/strspn.c b/lib/libc/string/strspn.c
index 3b7036cc..afbfabe8 100644
--- a/lib/libc/string/strspn.c
+++ b/lib/libc/string/strspn.c
@@ -1,4 +1,6 @@
-#include <string.h> // for size_t, strchr, strspn, NULL
+#include "stddef.h" // for NULL
+
+#include <string.h> // for size_t, strchr, strspn
size_t strspn(const char *s1, const char *s2)
{
diff --git a/lib/libc/string/strstr.c b/lib/libc/string/strstr.c
index 1c35e826..d0c53b1b 100644
--- a/lib/libc/string/strstr.c
+++ b/lib/libc/string/strstr.c
@@ -1,4 +1,5 @@
#include <stddef.h> // for NULL
+#include <string.h> // for strstr
char *strstr(const char *s1, const char *s2)
{
diff --git a/lib/libc/string/strtok.c b/lib/libc/string/strtok.c
index 918765b1..a2cbb417 100644
--- a/lib/libc/string/strtok.c
+++ b/lib/libc/string/strtok.c
@@ -1,4 +1,6 @@
-#include <string.h> // for NULL, strchr, strtok
+#include "stddef.h" // for NULL
+
+#include <string.h> // for strchr, strtok
char *strtok(char *restrict s, const char *restrict sep)
{
diff --git a/lib/libc/string/strtok_r.c b/lib/libc/string/strtok_r.c
index ee3fc243..274f6f08 100644
--- a/lib/libc/string/strtok_r.c
+++ b/lib/libc/string/strtok_r.c
@@ -1,4 +1,6 @@
-#include <string.h> // for NULL, strchr, strtok_r
+#include "stddef.h" // for NULL
+
+#include <string.h> // for strchr, strtok_r
char *strtok_r(char *restrict s, const char *restrict sep,
char **restrict state)
diff --git a/lib/libc/string/strxfrm.c b/lib/libc/string/strxfrm.c
index 947a4331..ae51f984 100644
--- a/lib/libc/string/strxfrm.c
+++ b/lib/libc/string/strxfrm.c
@@ -1,9 +1,7 @@
-#include "__stdio.h" // for size_t
#include "features.h" // for __weak
#include <libc.h> // for __unused
-#include <locale.h> // for locale_t
-#include <string.h> // for strlcpy, strlen, strxfrm, strxfrm_l
+#include <string.h> // for size_t, strlcpy, strlen, strxfrm, locale_t
size_t strxfrm(char *restrict s1, const char *restrict s2, size_t n)
{