add lstremove_next and lstadd_back now return
This commit is contained in:
@@ -6,13 +6,14 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/11/25 14:11:53 by hulamy #+# #+# */
|
||||
/* Updated: 2019/11/25 14:36:12 by hulamy ### ########.fr */
|
||||
/* Updated: 2022/03/23 21:50:42 by simplonco ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
/*
|
||||
** add an element to the end of a list
|
||||
** or first if list has no element so far
|
||||
** add an element to the end of a list, or first if list has no element yet
|
||||
** return NULL if element is NULL (eg, it returned from ft_lstnew and failed)
|
||||
** or else address to the element added
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -71,10 +72,12 @@
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void ft_lstadd_back(t_list **alst, t_list *new)
|
||||
void *ft_lstadd_back(t_list **alst, t_list *new)
|
||||
{
|
||||
t_list *tmp;
|
||||
|
||||
if (!new)
|
||||
return (NULL);
|
||||
if (alst)
|
||||
{
|
||||
tmp = *alst;
|
||||
@@ -87,4 +90,5 @@ void ft_lstadd_back(t_list **alst, t_list *new)
|
||||
tmp->next = new;
|
||||
}
|
||||
}
|
||||
return (tmp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user