This commit is contained in:
Antoine Riard 2017-03-08 03:09:51 +01:00
parent 7d714e1008
commit 2425e8e627
11 changed files with 46 additions and 13 deletions

View file

@ -6,7 +6,7 @@
# By: jhalford <jack@crans.org> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2017/02/07 16:09:36 by jhalford #+# #+# #
# Updated: 2017/03/07 14:28:55 by ariard ### ########.fr #
# Updated: 2017/03/08 01:11:01 by ariard ### ########.fr #
# #
# **************************************************************************** #
@ -94,6 +94,7 @@ lst/ft_lst_sorted_merge.c\
lst/ft_lstadd.c\
lst/ft_lstdel.c\
lst/ft_lstdelone.c\
lst/ft_lstdup.c\
lst/ft_lsteadd.c\
lst/ft_lstiter.c\
lst/ft_lstlast.c\
@ -150,6 +151,7 @@ str/ft_strbetween.c\
str/ft_strcat.c\
str/ft_strcatf.c\
str/ft_strchr.c\
str/ft_strchrcpy.c\
str/ft_strclr.c\
str/ft_strcmp.c\
str/ft_strcpy.c\
@ -173,7 +175,6 @@ str/ft_strmapi.c\
str/ft_strncat.c\
str/ft_strncmp.c\
str/ft_strncpy.c\
str/ft_strchrcpy.c\
str/ft_strnequ.c\
str/ft_strnew.c\
str/ft_strnstr.c\

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/07 13:27:46 by jhalford #+# #+# */
/* Updated: 2017/03/03 13:36:18 by jhalford ### ########.fr */
/* Updated: 2017/03/08 01:44:29 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -33,6 +33,7 @@ void ft_lstdelone(t_list **alst, void (*del)(void *, size_t));
void ft_lstadd(t_list **alst, t_list *new);
void ft_lstiter(t_list *lst, void (*f)(t_list *elem));
t_list *ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem));
t_list *ft_lstdup(t_list **lst, void *(*f)(void *content));
t_list *ft_lstnew_range(int a, int b);
void ft_lsteadd(t_list **alst, t_list *new);

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/08/16 13:43:51 by jhalford #+# #+# */
/* Updated: 2016/11/14 16:11:49 by jhalford ### ########.fr */
/* Updated: 2017/03/08 00:35:44 by ariard ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,8 +6,7 @@ t_btree *btree_map(t_btree *root, void *(*f)(void *))
if (!root)
return (NULL);
new = btree_create_node(root->item, root->content_size);
new->item = (*f)(new->item);
new = btree_create_node((*f)(root->item), root->content_size);
new->left = btree_map(root->left, f);
new->right = btree_map(root->right, f);
return (new);

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/04 11:08:55 by jhalford #+# #+# */
/* Updated: 2017/03/02 17:47:34 by jhalford ### ########.fr */
/* Updated: 2017/03/07 22:43:40 by ariard ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* ft_list_reverse.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* By: jhalford <marvin@43.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/08/14 13:20:13 by jhalford #+# #+# */
/* Updated: 2016/11/04 11:09:34 by jhalford ### ########.fr */
/* Updated: 2017/03/08 00:31:33 by ariard ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/03 14:57:13 by jhalford #+# #+# */
/* Updated: 2017/02/09 21:50:08 by jhalford ### ########.fr */
/* Updated: 2017/03/08 00:19:43 by ariard ### ########.fr */
/* */
/* ************************************************************************** */

32
libft/src/lst/ft_lstdup.c Normal file
View file

@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/08 00:14:44 by ariard #+# #+# */
/* Updated: 2017/03/08 01:44:22 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstdup(t_list **lst, void *(*f)(void *content))
{
t_list *new;
t_list *tp;
void *temp;
new = NULL;
tp = *lst;
while (tp)
{
temp = (*f)((*lst)->content);
ft_lstadd(&new, ft_lstnew(temp, sizeof(temp)));
tp = tp->next;
}
ft_lst_reverse(&new);
return (new);
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/03 14:57:21 by jhalford #+# #+# */
/* Updated: 2017/03/02 17:48:58 by jhalford ### ########.fr */
/* Updated: 2017/03/07 22:45:41 by ariard ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/29 15:57:38 by jhalford #+# #+# */
/* Updated: 2017/02/09 21:37:14 by jhalford ### ########.fr */
/* Updated: 2017/03/08 00:21:44 by ariard ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/07 14:25:45 by jhalford #+# #+# */
/* Updated: 2017/01/11 17:49:34 by jhalford ### ########.fr */
/* Updated: 2017/03/07 19:58:12 by ariard ### ########.fr */
/* */
/* ************************************************************************** */