lstiter reparee fonction sapplique sur content

This commit is contained in:
Hugo LAMY
2019-11-29 16:27:48 +01:00
parent ced3108518
commit aa802f51c9
4 changed files with 24 additions and 17 deletions

View File

@@ -6,7 +6,7 @@
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/25 14:15:42 by hulamy #+# #+# */
/* Updated: 2019/11/25 14:34:19 by hulamy ### ########.fr */
/* Updated: 2019/11/29 16:21:26 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -102,12 +102,12 @@ t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *))
if (!lst)
return (NULL);
tmp = (t_list*)f(lst);
tmp = (t_list*)f(lst->content);
new = tmp;
while (lst->next)
{
lst = lst->next;
if (!(tmp->next = (t_list*)f(lst)))
if (!(tmp->next = (t_list*)f(lst->content)))
{
del(tmp->next->content);
free(tmp->next);