tgrekov-fdf
HIVE fdf May 2024
Loading...
Searching...
No Matches
ft_lstmap_bonus.c File Reference

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstmap_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/28 01:50:13 by tgrekov #+# #+# */
/* Updated: 2023/11/20 19:22:20 by tgrekov ### ########.fr */
/* */
/* ************************************************************************** */

Definition in file ft_lstmap_bonus.c.

#include "libft.h"
Include dependency graph for ft_lstmap_bonus.c:

Go to the source code of this file.

Functions

t_listft_lstmap (t_list *lst, void *(*f)(void *), void(*del)(void *))
 Iterate over a list and create a new one from the results of applying f to the content of each node.
 

Function Documentation

◆ ft_lstmap()

t_list * ft_lstmap ( t_list lst,
void *(*)(void *)  f,
void(*)(void *)  del 
)

Iterate over a list and create a new one from the results of applying f to the content of each node.

Parameters
[in]lstPointer to the starting node
[in]fFunction which takes the content of the current node and returns the content for the new node
[in]delFunction used to properly handle deletion of each node's content in the new list, should allocation fail
Return values
t_list*Pointer to the first node in the new list

Definition at line 35 of file ft_lstmap_bonus.c.

References s_list::content, ft_lstadd_back(), ft_lstclear(), ft_lstnew(), and s_list::next.

Here is the call graph for this function: