mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2025-04-19 01:17:00 +02:00
14 lines
260 B
C
14 lines
260 B
C
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
void *calloc(size_t nmemb, size_t size)
|
|
{
|
|
unsigned int total_size;
|
|
|
|
if(__builtin_umul_overflow(nmemb, size, &total_size))
|
|
return NULL;
|
|
|
|
void *mem = malloc(total_size);
|
|
if(mem) memset(mem, 0, size);
|
|
return mem;
|
|
}
|