feat: ft_lstadd_back

This commit is contained in:
gbrochar 2024-10-13 19:10:04 +02:00
parent 88ac06645f
commit a9a3c473d5
3 changed files with 12 additions and 3 deletions

View File

@ -6,7 +6,7 @@
# By: gbrochar <marvin@42.fr> +#+ +:+ +#+ # # By: gbrochar <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2015/11/27 19:26:17 by gbrochar #+# #+# # # Created: 2015/11/27 19:26:17 by gbrochar #+# #+# #
# Updated: 2015/12/09 16:47:26 by gbrochar ### ########.fr # # Updated: 2024/10/13 18:44:22 by gbrochar ### ########.fr #
# # # #
# **************************************************************************** # # **************************************************************************** #
@ -22,7 +22,7 @@ ft_strchr.c ft_strclr.c ft_strcmp.c ft_strcpy.c ft_strdel.c ft_strdup.c \
ft_strequ.c ft_striter.c ft_striteri.c ft_strjoin.c ft_strlcat.c ft_strlen.c \ ft_strequ.c ft_striter.c ft_striteri.c ft_strjoin.c ft_strlcat.c ft_strlen.c \
ft_strmap.c ft_strmapi.c ft_strncat.c ft_strncmp.c ft_strncpy.c ft_strnequ.c \ ft_strmap.c ft_strmapi.c ft_strncat.c ft_strncmp.c ft_strncpy.c ft_strnequ.c \
ft_strnew.c ft_strnstr.c ft_strrchr.c ft_strsplit.c ft_strstr.c ft_strsub.c \ ft_strnew.c ft_strnstr.c ft_strrchr.c ft_strsplit.c ft_strstr.c ft_strsub.c \
ft_strtrim.c ft_swap.c ft_tolower.c ft_toupper.c ft_strtrim.c ft_swap.c ft_tolower.c ft_toupper.c ft_lstadd_back.c
OBJ = $(SRC:.c=.o) OBJ = $(SRC:.c=.o)

8
ft_lstadd_back.c Normal file
View File

@ -0,0 +1,8 @@
#include "libft.h"
void ft_lstadd_back(t_list **alst, t_list *new)
{
while ((*alst)->next)
alst = &(*alst)->next;
(*alst)->next = new;
}

View File

@ -6,7 +6,7 @@
/* By: gbrochar <marvin@42.fr> +#+ +:+ +#+ */ /* By: gbrochar <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2015/11/24 12:52:28 by gbrochar #+# #+# */ /* Created: 2015/11/24 12:52:28 by gbrochar #+# #+# */
/* Updated: 2015/12/07 09:31:40 by gbrochar ### ########.fr */ /* Updated: 2024/10/13 18:45:37 by gbrochar ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -25,6 +25,7 @@ typedef struct s_list
} t_list; } t_list;
void ft_lstadd(t_list **alst, t_list *new); void ft_lstadd(t_list **alst, t_list *new);
void ft_lstadd_back(t_list **alst, t_list *new);
void ft_lstdel(t_list **alst, void (*del)(void *, size_t)); void ft_lstdel(t_list **alst, void (*del)(void *, size_t));
void ft_lstdelone(t_list **alst, void (*del)(void *, size_t)); void ft_lstdelone(t_list **alst, void (*del)(void *, size_t));
t_list *ft_lstnew(void const *content, size_t content_size); t_list *ft_lstnew(void const *content, size_t content_size);