From: = <=> Date: Mon, 3 Nov 2025 11:51:49 +0000 (+0100) Subject: Bonus fix and var_end call on errors X-Git-Url: https://git.uwuaxy.net/?a=commitdiff_plain;h=ebd489fc44e2ac63ad6bb8162ba21a539da5dbec;p=axy%2Fft%2Fft_printf.git Bonus fix and var_end call on errors --- diff --git a/Makefile b/Makefile index 7835d12..b9feb66 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,6 @@ fclean : clean re : fclean all -bonus : +bonus : ${NAME} .PHONY : all clean fclean re bonus diff --git a/ft_printf.c b/ft_printf.c index 000bdd4..5b4ce0b 100644 --- a/ft_printf.c +++ b/ft_printf.c @@ -6,7 +6,7 @@ /* By: agilliar +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/10/29 14:24:47 by agilliar #+# #+# */ -/* Updated: 2025/11/01 00:21:44 by agilliar ### ########.fr */ +/* Updated: 2025/11/03 12:51:25 by agilliar ### ########.fr */ /* */ /* ************************************************************************** */ @@ -89,7 +89,7 @@ int ft_printf(const char *s, ...) { written = ft_printf_step(&s, &format, arg); if (written == -1) - return (-1); + return (va_end(args), -1); count += written; if (specifier_to_step(format.specifier) == STEP_INT) arg.v_int = va_arg(args, int); @@ -98,6 +98,5 @@ int ft_printf(const char *s, ...) if (specifier_to_step(format.specifier) == STEP_PTR) arg.v_ptr = va_arg(args, void *); } - va_end(args); - return (count); + return (va_end(args), count); }