X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/80e2389990082500d76eb566d4946be3e786c3ef..d8f41ccd20de16f8ebe2ccc84d47bf1cb2b26bbb:/SecurityTests/clxutils/threadTest/t_stdlib.c diff --git a/SecurityTests/clxutils/threadTest/t_stdlib.c b/SecurityTests/clxutils/threadTest/t_stdlib.c new file mode 100644 index 00000000..b2a65bd5 --- /dev/null +++ b/SecurityTests/clxutils/threadTest/t_stdlib.c @@ -0,0 +1,53 @@ +#include +#include +#include +#include + +void T_free(POINTER block) +{ + if (block != NULL_PTR) { + free(block); + } +} + +POINTER T_malloc(unsigned int len) +{ + return (POINTER) malloc(len ? len : 1); +} + +int T_memcmp(POINTER firstBlock, POINTER secondBlock, unsigned int len) +{ + if (len == 0) { + return 0; + } + return memcmp(firstBlock, secondBlock, len); +} + +void T_memcpy(POINTER output, POINTER input, unsigned int len) +{ + if (len != 0) { + memcpy(output, input, len); + } +} + +void T_memmove(POINTER output, POINTER input, unsigned int len) +{ + if (len != 0) { + memmove(output, input, len); + } +} + +void T_memset(POINTER output, int value, unsigned int len) +{ + if (len != 0) { + memset(output, value, len); + } +} + +POINTER T_realloc(POINTER block, unsigned int len) +{ + if (block == NULL_PTR) + return (POINTER) malloc(len ? len : 1); + + return (POINTER)realloc(block, len); +}