Use memset(3) on calloc(3)
This commit is contained in:
parent
bea2c98a06
commit
7de5b52faa
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue