/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_calloc.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: grobledo +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/02/08 19:35:13 by grobledo #+# #+# */ /* Updated: 2023/02/08 19:35:23 by grobledo ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void *ft_calloc(size_t count, size_t size) { void *str; size_t tmp; tmp = size * count; if (size == 0 || count == 0) return (malloc(0)); if (tmp / count != size) return (NULL); str = malloc(size * count); if (str == NULL) return (NULL); ft_bzero (str, size * count); return (str); }