diff --git a/libpsx/src/memory.c b/libpsx/src/memory.c index 1d0e6de..3c63dc7 100644 --- a/libpsx/src/memory.c +++ b/libpsx/src/memory.c @@ -115,14 +115,9 @@ malloc_keep_finding: void *calloc(size_t number, size_t size) { void *ptr = malloc(number * size); - unsigned char *cptr = (unsigned char*)ptr; - int x; - if(ptr == NULL) - ptr = NULL; - - for(x = 0; x < (number * size); x++) - cptr[x] = 0; + if (ptr) + memset(ptr, 0, number * size); return ptr; }