Make test files buildable for glibc

This commit is contained in:
Wildan M
2026-03-25 03:11:33 +07:00
parent 186dc66818
commit 46379d7001
34 changed files with 67 additions and 39 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ int main(void) {
puts("Correct memrchr");
char arr2[51];
memset(arr2, 0, 51); // Compiler builtin, should work
memccpy((void *)arr2, (void *)arr, 1, 100);
memccpy((void *)arr2, (void *)arr, 1, 51);
if (arr[50] != 1) {
puts("Incorrect memccpy");
exit(EXIT_FAILURE);
+3
View File
@@ -48,6 +48,8 @@ int main(void) {
exit(EXIT_FAILURE);
}
// no strnlen_s on glibc
#ifndef __GLIBC__
dest1_len = strnlen_s(dest1, 6);
printf("%d\n", dest1_len);
if(dest1_len != 6) {
@@ -68,6 +70,7 @@ int main(void) {
puts("strnlen_s(NULL, 100) failed");
exit(EXIT_FAILURE);
}
#endif
return 0;
}