LibC: Implement deprecated bcmp, bcopy, bzero

This commit is contained in:
Bananymous 2025-06-28 18:36:04 +03:00
parent 96f3efbf86
commit e4f025edd6
2 changed files with 21 additions and 0 deletions

View File

@ -18,6 +18,11 @@ int strcasecmp_l(const char* s1, const char* s2, locale_t locale);
int strncasecmp(const char* s1, const char* s2, size_t n);
int strncasecmp_l(const char* s1, const char* s2, size_t n, locale_t locale);
// deprecated
int bcmp(const void* s1, const void* s2, size_t n);
void bcopy(const void* src, void* dest, size_t n);
void bzero(void* s, size_t n);
__END_DECLS
#endif

View File

@ -1,4 +1,5 @@
#include <ctype.h>
#include <string.h>
#include <strings.h>
int ffs(int i)
@ -28,3 +29,18 @@ int strncasecmp(const char* s1, const char* s2, size_t n)
break;
return tolower(*u1) - tolower(*u2);
}
int bcmp(const void* s1, const void* s2, size_t n)
{
return memcmp(s1, s2, n);
}
void bcopy(const void* src, void* dest, size_t n)
{
memmove(dest, src, n);
}
void bzero(void* s, size_t n)
{
memset(s, 0, n);
}