From e4a7afd78b7addd4aaad921798c0f1a36735e676 Mon Sep 17 00:00:00 2001 From: Jack Halford Date: Fri, 4 Nov 2016 11:17:02 +0100 Subject: [PATCH] some norm changes for lst functions --- libftasm/src/lst/ft_id.c | 12 ++++++++++++ libftasm/src/lst/ft_lst_cfree.c | 12 ++++++++++++ libftasm/src/lst/ft_lst_delif.c | 18 ++++++++++++++++-- libftasm/src/lst/ft_lst_delsub.c | 17 ++++++++++++++++- libftasm/src/lst/ft_lst_filter.c | 24 ++++++++++++++++-------- libftasm/src/lst/ft_lst_find.c | 12 ++++++++++++ libftasm/src/lst/ft_lst_merge.c | 2 +- libftasm/src/lst/ft_lst_order_delsub.c | 12 ++++++++++++ libftasm/src/lst/ft_lst_print.c | 12 ++++++++++++ libftasm/src/lst/ft_lst_print2.c | 12 ++++++++++++ libftasm/src/lst/ft_lst_removeif.c | 12 ++++++++++++ libftasm/src/lst/ft_lst_reverse.c | 2 +- libftasm/src/lst/ft_lst_size.c | 12 ++++++++++++ libftasm/src/lst/ft_lst_sort.c | 12 ++++++++++++ libftasm/src/lst/ft_lst_sorted_insert.c | 12 ++++++++++++ libftasm/src/lst/ft_lst_sorted_merge.c | 12 ++++++++++++ libftasm/src/lst/ft_lstadd.c | 2 +- libftasm/src/lst/ft_lstlast.c | 12 ++++++++++++ libftasm/src/lst/ft_lstnadd.c | 12 ++++++++++++ libftasm/src/lst/ft_lstnew_range.c | 12 ++++++++++++ libftasm/src/lst/ft_lstpop.c | 12 ++++++++++++ libftasm/src/lst/ft_lstsort.c | 12 ++++++++++++ 22 files changed, 243 insertions(+), 14 deletions(-) diff --git a/libftasm/src/lst/ft_id.c b/libftasm/src/lst/ft_id.c index e5624755..a1a622a7 100644 --- a/libftasm/src/lst/ft_id.c +++ b/libftasm/src/lst/ft_id.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_id.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:08:55 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:10:25 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" t_list *ft_id(t_list *a) diff --git a/libftasm/src/lst/ft_lst_cfree.c b/libftasm/src/lst/ft_lst_cfree.c index deb40281..1cd33c11 100644 --- a/libftasm/src/lst/ft_lst_cfree.c +++ b/libftasm/src/lst/ft_lst_cfree.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lst_cfree.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:10 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:09:11 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" void ft_lst_cfree(void *ptr, size_t size) diff --git a/libftasm/src/lst/ft_lst_delif.c b/libftasm/src/lst/ft_lst_delif.c index b2943895..7319abc9 100644 --- a/libftasm/src/lst/ft_lst_delif.c +++ b/libftasm/src/lst/ft_lst_delif.c @@ -1,6 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lst_delif.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:12 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:11:54 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" -void ft_lst_delif(t_list **alst, void *data_ref, int (*cmp)(), void (*del)(void *, size_t)) +void ft_lst_delif( + t_list **alst, + void *data_ref, int (*cmp)(), + void (*del)(void *, size_t)) { t_list *last; t_list *current; @@ -28,4 +43,3 @@ void ft_lst_delif(t_list **alst, void *data_ref, int (*cmp)(), void (*del)(void } } } - diff --git a/libftasm/src/lst/ft_lst_delsub.c b/libftasm/src/lst/ft_lst_delsub.c index ef83d859..568bb767 100644 --- a/libftasm/src/lst/ft_lst_delsub.c +++ b/libftasm/src/lst/ft_lst_delsub.c @@ -1,6 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lst_delsub.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:15 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:12:28 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" -void ft_lst_delsub(t_list **alst, t_list *sub, int (*cmp)(), void (*del)(void *, size_t)) +void ft_lst_delsub( + t_list **alst, + t_list *sub, int (*cmp)(), + void (*del)(void *, size_t)) { t_list *last; t_list *current; diff --git a/libftasm/src/lst/ft_lst_filter.c b/libftasm/src/lst/ft_lst_filter.c index 537dbb47..8676c5f1 100644 --- a/libftasm/src/lst/ft_lst_filter.c +++ b/libftasm/src/lst/ft_lst_filter.c @@ -1,6 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lst_filter.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:17 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:11:30 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" -t_list *ft_lst_filter(t_list *lst, void const *data_ref, t_list *(*f)(t_list *elem, void const *)) +t_list *ft_lst_filter( + t_list *lst, + void const *data_ref, + t_list *(*f)(t_list *elem, void const *)) { t_list *out; t_list *elem; @@ -9,16 +24,9 @@ t_list *ft_lst_filter(t_list *lst, void const *data_ref, t_list *(*f)(t_list *el while (lst) { elem = (*f)(lst, data_ref); - /* printf("size=%zu\n", elem->content_size); */ - /* printf("content=%i\n", *(int*)elem->content); */ - /* fflush(stdout); */ elem = ft_lstnew(elem->content, elem->content_size); - /* printf("size=%zu\n", elem->content_size); */ - /* printf("content=%i\n", *(int*)elem->content); */ - /* fflush(stdout); */ ft_lsteadd(&out, elem); lst = lst->next; } - /* ft_lst_print(out, &ft_putnbr); */ return (out); } diff --git a/libftasm/src/lst/ft_lst_find.c b/libftasm/src/lst/ft_lst_find.c index 26eaed05..140814e1 100644 --- a/libftasm/src/lst/ft_lst_find.c +++ b/libftasm/src/lst/ft_lst_find.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lst_find.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:20 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:09:20 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" t_list *ft_lst_find(t_list *begin_list, void *data_ref, int (*cmp)()) diff --git a/libftasm/src/lst/ft_lst_merge.c b/libftasm/src/lst/ft_lst_merge.c index 4860f669..f8160381 100644 --- a/libftasm/src/lst/ft_lst_merge.c +++ b/libftasm/src/lst/ft_lst_merge.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/08/14 13:50:32 by jhalford #+# #+# */ -/* Updated: 2016/08/16 20:49:02 by jhalford ### ########.fr */ +/* Updated: 2016/11/04 11:09:24 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/libftasm/src/lst/ft_lst_order_delsub.c b/libftasm/src/lst/ft_lst_order_delsub.c index 1d57c477..53e9a079 100644 --- a/libftasm/src/lst/ft_lst_order_delsub.c +++ b/libftasm/src/lst/ft_lst_order_delsub.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lst_order_delsub.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:25 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:09:26 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" void ft_lst_delsub(t_list **alst, t_list *sub, int (*cmp)(), void (*del)(void *, size_t)) diff --git a/libftasm/src/lst/ft_lst_print.c b/libftasm/src/lst/ft_lst_print.c index dbd9d83f..94e5f315 100644 --- a/libftasm/src/lst/ft_lst_print.c +++ b/libftasm/src/lst/ft_lst_print.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lst_print.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:27 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:09:28 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" void ft_lst_print(t_list *list, void (*printer)()) diff --git a/libftasm/src/lst/ft_lst_print2.c b/libftasm/src/lst/ft_lst_print2.c index 9721f722..875167d1 100644 --- a/libftasm/src/lst/ft_lst_print2.c +++ b/libftasm/src/lst/ft_lst_print2.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lst_print2.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:29 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:09:29 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" void ft_lst_print2(t_list *list, void (*printer)()) diff --git a/libftasm/src/lst/ft_lst_removeif.c b/libftasm/src/lst/ft_lst_removeif.c index fe323ff7..bf757b81 100644 --- a/libftasm/src/lst/ft_lst_removeif.c +++ b/libftasm/src/lst/ft_lst_removeif.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lst_removeif.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:30 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:09:31 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" t_list *ft_lst_removeif(t_list **alst, void *data_ref, int (*cmp)()) diff --git a/libftasm/src/lst/ft_lst_reverse.c b/libftasm/src/lst/ft_lst_reverse.c index 1445df17..48b14d9e 100644 --- a/libftasm/src/lst/ft_lst_reverse.c +++ b/libftasm/src/lst/ft_lst_reverse.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/08/14 13:20:13 by jhalford #+# #+# */ -/* Updated: 2016/08/16 22:34:13 by jhalford ### ########.fr */ +/* Updated: 2016/11/04 11:09:34 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/libftasm/src/lst/ft_lst_size.c b/libftasm/src/lst/ft_lst_size.c index bdb1895e..1f8c03b8 100644 --- a/libftasm/src/lst/ft_lst_size.c +++ b/libftasm/src/lst/ft_lst_size.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lst_size.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:35 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:09:36 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" int ft_lstsize(t_list *lst) diff --git a/libftasm/src/lst/ft_lst_sort.c b/libftasm/src/lst/ft_lst_sort.c index 905aa624..f7aedb68 100644 --- a/libftasm/src/lst/ft_lst_sort.c +++ b/libftasm/src/lst/ft_lst_sort.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lst_sort.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:37 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:09:38 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" static void ft_lst_swap(t_list **current) diff --git a/libftasm/src/lst/ft_lst_sorted_insert.c b/libftasm/src/lst/ft_lst_sorted_insert.c index b5e3cfa2..f4821326 100644 --- a/libftasm/src/lst/ft_lst_sorted_insert.c +++ b/libftasm/src/lst/ft_lst_sorted_insert.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lst_sorted_insert.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:39 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:09:39 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" void ft_lst_sorted_insert(t_list **begin_list, t_list *insert, int (*cmp)()) diff --git a/libftasm/src/lst/ft_lst_sorted_merge.c b/libftasm/src/lst/ft_lst_sorted_merge.c index eb5e0d5d..38308849 100644 --- a/libftasm/src/lst/ft_lst_sorted_merge.c +++ b/libftasm/src/lst/ft_lst_sorted_merge.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lst_sorted_merge.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:40 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:09:40 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" void ft_lst_sorted_merge( diff --git a/libftasm/src/lst/ft_lstadd.c b/libftasm/src/lst/ft_lstadd.c index 8ac0d1f3..f2064d9f 100644 --- a/libftasm/src/lst/ft_lstadd.c +++ b/libftasm/src/lst/ft_lstadd.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/03 14:57:13 by jhalford #+# #+# */ -/* Updated: 2016/11/03 14:57:13 by jhalford ### ########.fr */ +/* Updated: 2016/11/04 11:09:44 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/libftasm/src/lst/ft_lstlast.c b/libftasm/src/lst/ft_lstlast.c index daaa94f4..b8019f8f 100644 --- a/libftasm/src/lst/ft_lstlast.c +++ b/libftasm/src/lst/ft_lstlast.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstlast.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:48 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:09:49 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" t_list *ft_lstlast(t_list *lst) diff --git a/libftasm/src/lst/ft_lstnadd.c b/libftasm/src/lst/ft_lstnadd.c index 7db6c631..3f542fad 100644 --- a/libftasm/src/lst/ft_lstnadd.c +++ b/libftasm/src/lst/ft_lstnadd.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstnadd.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:51 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:09:52 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" void ft_lstnadd(t_list **alst, t_list *new, int n) diff --git a/libftasm/src/lst/ft_lstnew_range.c b/libftasm/src/lst/ft_lstnew_range.c index 985a5182..26632a3b 100644 --- a/libftasm/src/lst/ft_lstnew_range.c +++ b/libftasm/src/lst/ft_lstnew_range.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstnew_range.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:54 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:09:54 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" t_list *ft_lstnew_range(int a, int b) diff --git a/libftasm/src/lst/ft_lstpop.c b/libftasm/src/lst/ft_lstpop.c index 7a7831ba..2b0ac748 100644 --- a/libftasm/src/lst/ft_lstpop.c +++ b/libftasm/src/lst/ft_lstpop.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstpop.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:56 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:09:56 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" t_list *ft_lstpop(t_list **lst) diff --git a/libftasm/src/lst/ft_lstsort.c b/libftasm/src/lst/ft_lstsort.c index 1b7eb7d0..4f0a8817 100644 --- a/libftasm/src/lst/ft_lstsort.c +++ b/libftasm/src/lst/ft_lstsort.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstsort.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/04 11:09:58 by jhalford #+# #+# */ +/* Updated: 2016/11/04 11:09:59 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" static void ft_list_swap(t_list **current)