/* ************************************************************************** */1/* */2/* ::: :::::::: */3/* ft_calloc.c :+: :+: :+: */4/* +:+ +:+ +:+ */5/* By: yabtaour <[email protected]> +#+ +:+ +#+ */6/* +#+#+#+#+#+ +#+ */7/* Created: 2022/05/18 17:46:38 by yabtaour #+# #+# */8/* Updated: 2022/05/18 17:46:45 by yabtaour ### ########.fr */9/* */10/* ************************************************************************** */11#include "philosophers.h"1213void *ft_memset(void *b, int c, size_t len)14{15size_t i;16unsigned char *ptr;1718i = 0;19ptr = b;20while (len > 0)21{22ptr[i] = (unsigned char)c;23i++;24len--;25}26return (b);27}2829void ft_bzero(void *s, size_t n)30{31s = ft_memset(s, '\0', n);32}3334void *ft_calloc(int count, int size)35{36void *ptr;37int sizee;3839sizee = count * size;40ptr = (void *)malloc(sizee);41if (ptr != NULL)42ft_bzero(ptr, sizee);43else44return (NULL);45return (ptr);46}474849