32 lines
583 B
C

#include "../includes/philo_header.h"
void *ft_calloc(size_t num, size_t size)
{
void *addr;
unsigned int nbytes;
nbytes = num * size;
addr = malloc(nbytes);
if (!size || !num || (size == 0 && num == 0))
return ((void *)addr);
if (!addr)
return (NULL);
else
{
memset(addr, '\0', nbytes);
}
return ((void *)addr);
}
t_all *structalloc_and_bzero(void)
{
t_all *all;
all = ft_calloc(sizeof(t_all), 1);
all->number_of_philosophers = 0;
all->time_to_die = 0;
all->time_to_eat = 0;
all->time_to_sleep = 0;
all->number_of_times_each_philosopher_must_eat = 0;
}