Skip to content

Commit

Permalink
Merge pull request #979 from managarm/bcmp-bcopy
Browse files Browse the repository at this point in the history
options/posix: Add bcmp() and bcopy()
  • Loading branch information
mintsuki authored Feb 5, 2024
2 parents 08d7213 + f6dc8e7 commit 5454a48
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions options/posix/generic/strings-stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ int strncasecmp(const char *a, const char *b, size_t size) {
}

// Marked as obsolete in posix 2008 but used by at least tracker
int bcmp(const void *s1, const void *s2, size_t n) {
return memcmp(s1, s2, n);
}

void bcopy(const void *s1, void *s2, size_t n) {
memmove(s2, s1, n);
}

void bzero(void *s, size_t n) {
memset(s, 0, n);
}
Expand Down
4 changes: 3 additions & 1 deletion options/posix/include/strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ int ffs(int word);
int strcasecmp(const char *a, const char *b);
int strncasecmp(const char *a, const char *b, size_t size);

// Marked as obsolete in posix 2008 but used by at least tracker
/* Marked as obsolete in posix 2008 but used by at least tracker */
int bcmp(const void *s1, const void *s2, size_t n);
void bcopy(const void *s1, void *s2, size_t n);
void bzero(void *s, size_t n);

#endif /* !__MLIBC_ABI_ONLY */
Expand Down

0 comments on commit 5454a48

Please sign in to comment.