fix: add stdbool remove useless memset

This commit is contained in:
Camille Chauvet 2023-05-25 14:57:43 +02:00
parent 1b3c96b38d
commit f1927d349b
2 changed files with 5 additions and 10 deletions

View File

@ -6,20 +6,15 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/27 11:28:36 by cchauvet #+# #+# */
/* Updated: 2023/05/05 16:58:45 by cchauvet ### ########.fr */
/* Updated: 2023/05/25 14:48:52 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <pthread.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include "./data.h"
#include "philo.h"
#include "philos.h"
#include <string.h>
#include <unistd.h>
#include <stdbool.h>
bool data_init(t_data *data)
{
@ -29,7 +24,6 @@ bool data_init(t_data *data)
data->forks = malloc(sizeof(pthread_mutex_t) * data->nb_philos);
if (data->forks == NULL)
return (1);
memset(data->forks, 1, data->nb_philos);
data->philos = malloc(sizeof(t_philo) * data->nb_philos);
if (data->philos == NULL)
free(data->forks);

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/27 11:33:06 by cchauvet #+# #+# */
/* Updated: 2023/04/27 11:33:06 by cchauvet ### ########.fr */
/* Updated: 2023/05/25 14:49:38 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,6 +14,7 @@
# define DATA_H
# include <pthread.h>
# include <sys/types.h>
# include <stdbool.h>
typedef struct s_data
{