1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:48:13 +00:00

LibC: Add strnlen()

This commit is contained in:
Andreas Kling 2020-01-16 22:11:05 +01:00
parent 376fece51e
commit 60143c8d4e
2 changed files with 9 additions and 0 deletions

View file

@ -55,6 +55,14 @@ size_t strlen(const char* str)
return len;
}
size_t strnlen(const char* str, size_t maxlen)
{
size_t len = 0;
for (; len < maxlen && *str; str++)
len++;
return len;
}
char* strdup(const char* str)
{
size_t len = strlen(str);