LibC: Fix memmem signature compliance

This commit is contained in:
Emily Trau 2023-06-04 16:49:03 -07:00 committed by Andreas Kling
parent 7f6a49c085
commit 04b06afd39
Notes: sideshowbarker 2024-07-17 04:34:25 +09:00
2 changed files with 4 additions and 3 deletions

View File

@ -175,9 +175,10 @@ void* memmove(void* dest, void const* src, size_t n)
return dest;
}
void const* memmem(void const* haystack, size_t haystack_length, void const* needle, size_t needle_length)
// https://linux.die.net/man/3/memmem (GNU extension)
void* memmem(void const* haystack, size_t haystack_length, void const* needle, size_t needle_length)
{
return AK::memmem(haystack, haystack_length, needle, needle_length);
return const_cast<void*>(AK::memmem(haystack, haystack_length, needle, needle_length));
}
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcpy.html

View File

@ -28,7 +28,7 @@ int timingsafe_memcmp(void const*, void const*, size_t);
void* memcpy(void*, void const*, size_t);
void* memmove(void*, void const*, size_t);
void* memchr(void const*, int c, size_t);
void const* memmem(void const* haystack, size_t, void const* needle, size_t);
void* memmem(void const* haystack, size_t, void const* needle, size_t);
void* memset(void*, int, size_t);
void explicit_bzero(void*, size_t) __attribute__((nonnull(1)));