libft/list/ft_lstadd_front.c
Raphael 905ffd4b72
refactor: only the usefull header
- Removing all 'libft.h' mention
- Using the include only on the files needed by
2025-09-01 18:45:33 +02:00

31 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_front.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/12 11:40:16 by rparodi #+# #+# */
/* Updated: 2025/09/01 16:35:45 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "list.h"
#include <unistd.h>
/**
* @brief Add the list new to the front of chained list of lst
*
* @param lst first element of the list
* @param new The element to add at the start
*/
void ft_lstadd_front(t_list **lst, t_list *new)
{
if (*lst == NULL)
{
*lst = new;
return ;
}
new->next = *lst;
*lst = new;
}