mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 20:45:14 +00:00
LibC: Implement strchrnul()
This commit is contained in:
parent
ba9313111f
commit
a52b3e8f2a
Notes:
sideshowbarker
2024-07-19 09:09:27 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/a52b3e8f2a4 Pull-request: https://github.com/SerenityOS/serenity/pull/1214 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/bugaevc Reviewed-by: https://github.com/willmcpherson2
2 changed files with 10 additions and 0 deletions
|
@ -297,6 +297,15 @@ char* strchr(const char* str, int c)
|
|||
}
|
||||
}
|
||||
|
||||
char* strchrnul(const char* str, int c)
|
||||
{
|
||||
char ch = c;
|
||||
for (;; ++str) {
|
||||
if (*str == ch || !*str)
|
||||
return const_cast<char*>(str);
|
||||
}
|
||||
}
|
||||
|
||||
void* memchr(const void* ptr, int c, size_t size)
|
||||
{
|
||||
char ch = c;
|
||||
|
|
|
@ -49,6 +49,7 @@ char* strndup(const char*, size_t);
|
|||
char* strcpy(char* dest, const char* src);
|
||||
char* strncpy(char* dest, const char* src, size_t);
|
||||
char* strchr(const char*, int c);
|
||||
char* strchrnul(const char*, int c);
|
||||
char* strstr(const char* haystack, const char* needle);
|
||||
char* strrchr(const char*, int c);
|
||||
char* strcat(char* dest, const char* src);
|
||||
|
|
Loading…
Add table
Reference in a new issue