#include "libft.h" #include void * ft_calloc (size_t nmemb, size_t size) { void *ptr; size_t total; // Detect multiplication overflow before allocating. if (nmemb && size > (size_t)-1 / nmemb) return (NULL); total = nmemb * size; ptr = malloc (total); if (!ptr) return (NULL); ft_bzero (ptr, total); return (ptr); }