minishell/libft/libft/ft_lstdelone_bonus.c
2025-02-12 15:12:42 +01:00

25 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdelone_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jguelen <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/21 14:44:36 by jguelen #+# #+# */
/* Updated: 2024/10/23 16:33:32 by jguelen ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdlib.h>
/*Presumes del != NULL
Allows one to delete one single element of the generic chain.
The user is responsible of the dealing with any other element.*/
void ft_lstdelone(t_list *lst, void (*del)(void *))
{
if (lst == NULL)
return ;
del(lst->content);
free(lst);
}