diff --git a/libft/libft.h b/libft/libft.h index 5b9b7bb..5572385 100644 --- a/libft/libft.h +++ b/libft/libft.h @@ -6,7 +6,7 @@ /* By: jguelen +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/17 16:06:09 by jguelen #+# #+# */ -/* Updated: 2025/02/13 15:27:21 by khais ### ########.fr */ +/* Updated: 2025/02/19 12:25:40 by khais ### ########.fr */ /* */ /* ************************************************************************** */ @@ -165,5 +165,7 @@ void ft_lstdelone(t_list *lst, void (*del)(void *)); void ft_lstclear(t_list **lst, void (*del)(void *)); void ft_lstiter(t_list *lst, void (*f)(void *)); t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *)); +/*frees two pointers and returns NULL*/ +void *free2(void *p1, void *p2); #endif diff --git a/libft/libft/Makefile b/libft/libft/Makefile index 5c16a25..cebfad2 100644 --- a/libft/libft/Makefile +++ b/libft/libft/Makefile @@ -4,7 +4,8 @@ ifeq ($(CFLAGS),) CFLAGS = -Wall -Wextra -Werror -g endif NAME = libft.a -SOURCES = ft_atoi.c ft_itoa.c ft_putendl_fd.c ft_strlcat.c ft_substr.c \ +SOURCES = free2.c \ + ft_atoi.c ft_itoa.c ft_putendl_fd.c ft_strlcat.c ft_substr.c \ ft_bzero.c ft_putnbr_fd.c ft_strlcpy.c ft_tolower.c ft_calloc.c \ ft_memchr.c ft_putstr_fd.c ft_strlen.c ft_toupper.c ft_isalnum.c \ ft_memcmp.c ft_split.c ft_strmapi.c ft_isalpha.c ft_memcpy.c ft_strchr.c \ diff --git a/libft/libft/free2.c b/libft/libft/free2.c new file mode 100644 index 0000000..b053b0c --- /dev/null +++ b/libft/libft/free2.c @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* free2.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jguelen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/02/17 16:13:43 by jguelen #+# #+# */ +/* Updated: 2025/02/17 16:17:00 by jguelen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void *free2(void *p1, void *p2) +{ + free(p1); + free(p2); + return (NULL); +} diff --git a/libft/libft/libft.h b/libft/libft/libft.h index dd39740..f39e785 100644 --- a/libft/libft/libft.h +++ b/libft/libft/libft.h @@ -25,6 +25,7 @@ typedef struct s_list struct s_list *next; } t_list; +void *free2(void *p1, void *p2); int ft_isalpha(int c); int ft_isdigit(int c); int ft_isalnum(int c);