fix: lst -> slist
This commit is contained in:
parent
93da2c9ca6
commit
14adc54215
16 changed files with 48 additions and 46 deletions
23
srcs/slist/ft_slist_pop.c
Normal file
23
srcs/slist/ft_slist_pop.c
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#include "libft.h"
|
||||
|
||||
t_slist *ft_list_pop(t_slist **lst)
|
||||
{
|
||||
t_slist *current;
|
||||
t_slist *prev;
|
||||
|
||||
if (!lst || !*lst)
|
||||
return NULL;
|
||||
current = *lst;
|
||||
if (current->next == NULL)
|
||||
{
|
||||
*lst = NULL;
|
||||
return current;
|
||||
}
|
||||
while (current->next)
|
||||
{
|
||||
prev = current;
|
||||
current = current->next;
|
||||
}
|
||||
prev->next = NULL;
|
||||
return current;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue