add lstremove_next and lstadd_back now return
This commit is contained in:
30
srcs/ft_lstremove_next.c
Normal file
30
srcs/ft_lstremove_next.c
Normal file
@@ -0,0 +1,30 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_lstremove_next.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: simplonco <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/03/23 21:42:05 by simplonco #+# #+# */
|
||||
/* Updated: 2022/03/23 21:42:55 by simplonco ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
/*
|
||||
* remove the next element of the list, delete its content, and free it
|
||||
* then rejoin the list without this element
|
||||
*/
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void ft_lstremove_next(t_list *lst, void (*del)(void *))
|
||||
{
|
||||
t_list *next_tmp;
|
||||
|
||||
if (!lst || !lst->next || !del)
|
||||
return ;
|
||||
next_tmp = lst->next->next;
|
||||
del(lst->next->content);
|
||||
free(lst->next);
|
||||
lst->next = next_tmp;
|
||||
}
|
||||
Reference in New Issue
Block a user