From bbc14ea805b6f92e73aa41dd55bd8bce3177a365 Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Thu, 26 Sep 2024 10:36:03 +0200 Subject: [PATCH] Make the code adhere to the Norm --- philo/philo.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/philo/philo.c b/philo/philo.c index a2fd354..b8541c8 100644 --- a/philo/philo.c +++ b/philo/philo.c @@ -19,11 +19,12 @@ static void philo_think(t_philo *philo) return ; } -static void take_forks(t_philo *philo) +// The integer inputs are only there to save me a few lines in the +// function body +// This is precisely why I despise how the Norm is written +// This is much worse solution but it passes norminette +static void take_forks(t_philo *philo, int i, int forks_taken) { - int i; - int forks_taken; - i = 0; forks_taken = 0; while (forks_taken < 2 && !end(philo->settings)) @@ -52,7 +53,7 @@ static void take_forks(t_philo *philo) static void philo_eat(t_philo *philo) { - take_forks(philo); + take_forks(philo, 0, 0); report(philo, "has taken a fork"); report(philo, "has taken a fork"); mutex_lock(&philo->philo_lock); -- 2.30.2