From d971bd8d16608f316396aba7a579d0b1f1af5aeb Mon Sep 17 00:00:00 2001 From: nass1pro Date: Fri, 12 Jun 2020 13:52:58 +0200 Subject: Added e_token enum --- test_mini/libft/src/algo/ft_bsearch.c | 32 ----- test_mini/libft/src/algo/ft_compar_int.c | 18 --- test_mini/libft/src/algo/ft_heapsort.c | 54 ------- test_mini/libft/src/algo/ft_is_set.c | 32 ----- test_mini/libft/src/algo/ft_lfind.c | 28 ---- test_mini/libft/src/algo/ft_lsearch.c | 23 --- test_mini/libft/src/algo/ft_mergesort.c | 76 ---------- test_mini/libft/src/algo/ft_qsort.c | 64 --------- test_mini/libft/src/algo/ft_reverse.c | 27 ---- test_mini/libft/src/bt/ft_btdestroy.c | 23 --- test_mini/libft/src/bt/ft_btnew.c | 25 ---- test_mini/libft/src/ctype/ft_isalnum.c | 18 --- test_mini/libft/src/ctype/ft_isalpha.c | 16 --- test_mini/libft/src/ctype/ft_isascii.c | 16 --- test_mini/libft/src/ctype/ft_isblank.c | 16 --- test_mini/libft/src/ctype/ft_isdigit.c | 16 --- test_mini/libft/src/ctype/ft_isprint.c | 16 --- test_mini/libft/src/ctype/ft_isspace.c | 19 --- test_mini/libft/src/ctype/ft_todigit.c | 20 --- test_mini/libft/src/ctype/ft_tolower.c | 24 ---- test_mini/libft/src/ctype/ft_toupper.c | 20 --- test_mini/libft/src/ht/ft_htdelone.c | 29 ---- test_mini/libft/src/ht/ft_htdestroy.c | 30 ---- test_mini/libft/src/ht/ft_htentry_new.c | 37 ----- test_mini/libft/src/ht/ft_htget.c | 35 ----- test_mini/libft/src/ht/ft_hthash.c | 36 ----- test_mini/libft/src/ht/ft_htiter.c | 31 ----- test_mini/libft/src/ht/ft_htnew.c | 38 ----- test_mini/libft/src/ht/ft_htset.c | 56 -------- test_mini/libft/src/ht/ft_inter_htkey_cmp.c | 25 ---- test_mini/libft/src/io/ft_getchar.c | 22 --- test_mini/libft/src/io/ft_next_line.c | 113 --------------- test_mini/libft/src/io/ft_printf/ft_asprintf.c | 24 ---- test_mini/libft/src/io/ft_printf/ft_dprintf.c | 24 ---- test_mini/libft/src/io/ft_printf/ft_printf.c | 24 ---- test_mini/libft/src/io/ft_printf/ft_snprintf.c | 24 ---- test_mini/libft/src/io/ft_printf/ft_sprintf.c | 24 ---- test_mini/libft/src/io/ft_printf/ft_vasprintf.c | 21 --- test_mini/libft/src/io/ft_printf/ft_vasprintf.h | 155 --------------------- test_mini/libft/src/io/ft_printf/ft_vdprintf.c | 24 ---- test_mini/libft/src/io/ft_printf/ft_vprintf.c | 18 --- test_mini/libft/src/io/ft_printf/ft_vsnprintf.c | 26 ---- test_mini/libft/src/io/ft_printf/ft_vsprintf.c | 18 --- .../libft/src/io/ft_printf/internals/convert.c | 122 ---------------- .../src/io/ft_printf/internals/convert_char.c | 53 ------- .../libft/src/io/ft_printf/internals/convert_hex.c | 34 ----- .../libft/src/io/ft_printf/internals/convert_int.c | 40 ------ .../src/io/ft_printf/internals/convert_none.c | 25 ---- .../src/io/ft_printf/internals/convert_percent.c | 23 --- .../libft/src/io/ft_printf/internals/convert_ptr.c | 29 ---- .../libft/src/io/ft_printf/internals/convert_str.c | 25 ---- .../src/io/ft_printf/internals/convert_uint.c | 34 ----- .../src/io/ft_printf/internals/convert_written.c | 28 ---- .../libft/src/io/ft_printf/internals/extract.c | 98 ------------- .../src/io/ft_printf/internals/length_modifier.c | 39 ------ test_mini/libft/src/io/ft_printf/internals/list.c | 67 --------- test_mini/libft/src/io/ft_printf/internals/parse.c | 61 -------- test_mini/libft/src/io/ft_printf/internals/utils.c | 115 --------------- test_mini/libft/src/io/ft_putchar.c | 18 --- test_mini/libft/src/io/ft_putchar_fd.c | 20 --- test_mini/libft/src/io/ft_putendl.c | 18 --- test_mini/libft/src/io/ft_putendl_fd.c | 21 --- test_mini/libft/src/io/ft_putnbr.c | 18 --- test_mini/libft/src/io/ft_putnbr_fd.c | 30 ---- test_mini/libft/src/io/ft_putstr.c | 18 --- test_mini/libft/src/io/ft_putstr_fd.c | 20 --- test_mini/libft/src/lst/ft_lstbsearch.c | 65 --------- test_mini/libft/src/lst/ft_lstdelone.c | 27 ---- test_mini/libft/src/lst/ft_lstdestroy.c | 29 ---- test_mini/libft/src/lst/ft_lstiter.c | 29 ---- test_mini/libft/src/lst/ft_lstlast.c | 27 ---- test_mini/libft/src/lst/ft_lstlfind.c | 22 --- test_mini/libft/src/lst/ft_lstlsearch.c | 27 ---- test_mini/libft/src/lst/ft_lstmap.c | 56 -------- test_mini/libft/src/lst/ft_lstnew.c | 29 ---- test_mini/libft/src/lst/ft_lstpop_front.c | 29 ---- test_mini/libft/src/lst/ft_lstpush_back.c | 30 ---- test_mini/libft/src/lst/ft_lstpush_front.c | 26 ---- test_mini/libft/src/lst/ft_lstremove_if.c | 38 ----- test_mini/libft/src/lst/ft_lstreverse.c | 22 --- test_mini/libft/src/lst/ft_lstreverse_ret.c | 32 ----- test_mini/libft/src/lst/ft_lstsize.c | 31 ----- test_mini/libft/src/lst/ft_lstsort.c | 46 ------ test_mini/libft/src/lst/ft_lstsorted_merge.c | 43 ------ test_mini/libft/src/mem/ft_bzero.c | 18 --- test_mini/libft/src/mem/ft_calloc.c | 23 --- test_mini/libft/src/mem/ft_memalloc.c | 18 --- test_mini/libft/src/mem/ft_memccpy.c | 31 ----- test_mini/libft/src/mem/ft_memchr.c | 26 ---- test_mini/libft/src/mem/ft_memcmp.c | 30 ---- test_mini/libft/src/mem/ft_memcpy.c | 33 ----- test_mini/libft/src/mem/ft_memdel.c | 21 --- test_mini/libft/src/mem/ft_memmem.c | 58 -------- test_mini/libft/src/mem/ft_memmove.c | 35 ----- test_mini/libft/src/mem/ft_memset.c | 31 ----- test_mini/libft/src/mem/ft_memset_pattern4.c | 26 ---- test_mini/libft/src/mem/ft_memswap.c | 29 ---- test_mini/libft/src/str/ft_atoi.c | 22 --- test_mini/libft/src/str/ft_atoi_strict.c | 38 ----- test_mini/libft/src/str/ft_itoa.c | 40 ------ test_mini/libft/src/str/ft_split.c | 73 ---------- test_mini/libft/src/str/ft_strcasecmp.c | 24 ---- test_mini/libft/src/str/ft_strcat.c | 19 --- test_mini/libft/src/str/ft_strchr.c | 18 --- test_mini/libft/src/str/ft_strclr.c | 20 --- test_mini/libft/src/str/ft_strcmp.c | 23 --- test_mini/libft/src/str/ft_strcount.c | 24 ---- test_mini/libft/src/str/ft_strcpy.c | 18 --- test_mini/libft/src/str/ft_strcspn.c | 23 --- test_mini/libft/src/str/ft_strdel.c | 18 --- test_mini/libft/src/str/ft_strdup.c | 22 --- test_mini/libft/src/str/ft_strequ.c | 20 --- test_mini/libft/src/str/ft_striter.c | 21 --- test_mini/libft/src/str/ft_striteri.c | 27 ---- test_mini/libft/src/str/ft_strjoin.c | 25 ---- test_mini/libft/src/str/ft_strjoin3.c | 36 ----- test_mini/libft/src/str/ft_strjoinf.c | 35 ----- test_mini/libft/src/str/ft_strlcat.c | 32 ----- test_mini/libft/src/str/ft_strlcpy.c | 28 ---- test_mini/libft/src/str/ft_strlen.c | 41 ------ test_mini/libft/src/str/ft_strmap.c | 34 ----- test_mini/libft/src/str/ft_strmapi.c | 34 ----- test_mini/libft/src/str/ft_strncasecmp.c | 26 ---- test_mini/libft/src/str/ft_strncat.c | 29 ---- test_mini/libft/src/str/ft_strncmp.c | 26 ---- test_mini/libft/src/str/ft_strncpy.c | 24 ---- test_mini/libft/src/str/ft_strndup.c | 23 --- test_mini/libft/src/str/ft_strnequ.c | 20 --- test_mini/libft/src/str/ft_strnew.c | 18 --- test_mini/libft/src/str/ft_strnlen.c | 25 ---- test_mini/libft/src/str/ft_strnstr.c | 29 ---- test_mini/libft/src/str/ft_strpbrk.c | 24 ---- test_mini/libft/src/str/ft_strrchr.c | 24 ---- test_mini/libft/src/str/ft_strsep.c | 27 ---- test_mini/libft/src/str/ft_strspn.c | 23 --- test_mini/libft/src/str/ft_strstr.c | 29 ---- test_mini/libft/src/str/ft_strtol.c | 80 ----------- test_mini/libft/src/str/ft_strtolower.c | 26 ---- test_mini/libft/src/str/ft_strtoupper.c | 26 ---- test_mini/libft/src/str/ft_strtrim.c | 31 ----- test_mini/libft/src/str/ft_substr.c | 26 ---- test_mini/libft/src/util/ft_split_destroy.c | 24 ---- test_mini/libft/src/vec/ft_vecdestroy.c | 29 ---- test_mini/libft/src/vec/ft_vecgrow.c | 43 ------ test_mini/libft/src/vec/ft_veciter.c | 31 ----- test_mini/libft/src/vec/ft_vecnew.c | 38 ----- test_mini/libft/src/vec/ft_vecpop.c | 28 ---- test_mini/libft/src/vec/ft_vecpush.c | 30 ---- test_mini/libft/src/vec/ft_vecremove.c | 31 ----- 149 files changed, 4865 deletions(-) delete mode 100644 test_mini/libft/src/algo/ft_bsearch.c delete mode 100644 test_mini/libft/src/algo/ft_compar_int.c delete mode 100644 test_mini/libft/src/algo/ft_heapsort.c delete mode 100644 test_mini/libft/src/algo/ft_is_set.c delete mode 100644 test_mini/libft/src/algo/ft_lfind.c delete mode 100644 test_mini/libft/src/algo/ft_lsearch.c delete mode 100644 test_mini/libft/src/algo/ft_mergesort.c delete mode 100644 test_mini/libft/src/algo/ft_qsort.c delete mode 100644 test_mini/libft/src/algo/ft_reverse.c delete mode 100644 test_mini/libft/src/bt/ft_btdestroy.c delete mode 100644 test_mini/libft/src/bt/ft_btnew.c delete mode 100644 test_mini/libft/src/ctype/ft_isalnum.c delete mode 100644 test_mini/libft/src/ctype/ft_isalpha.c delete mode 100644 test_mini/libft/src/ctype/ft_isascii.c delete mode 100644 test_mini/libft/src/ctype/ft_isblank.c delete mode 100644 test_mini/libft/src/ctype/ft_isdigit.c delete mode 100644 test_mini/libft/src/ctype/ft_isprint.c delete mode 100644 test_mini/libft/src/ctype/ft_isspace.c delete mode 100644 test_mini/libft/src/ctype/ft_todigit.c delete mode 100644 test_mini/libft/src/ctype/ft_tolower.c delete mode 100644 test_mini/libft/src/ctype/ft_toupper.c delete mode 100644 test_mini/libft/src/ht/ft_htdelone.c delete mode 100644 test_mini/libft/src/ht/ft_htdestroy.c delete mode 100644 test_mini/libft/src/ht/ft_htentry_new.c delete mode 100644 test_mini/libft/src/ht/ft_htget.c delete mode 100644 test_mini/libft/src/ht/ft_hthash.c delete mode 100644 test_mini/libft/src/ht/ft_htiter.c delete mode 100644 test_mini/libft/src/ht/ft_htnew.c delete mode 100644 test_mini/libft/src/ht/ft_htset.c delete mode 100644 test_mini/libft/src/ht/ft_inter_htkey_cmp.c delete mode 100644 test_mini/libft/src/io/ft_getchar.c delete mode 100644 test_mini/libft/src/io/ft_next_line.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_asprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_dprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_printf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_snprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_sprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_vasprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_vasprintf.h delete mode 100644 test_mini/libft/src/io/ft_printf/ft_vdprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_vprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_vsnprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/ft_vsprintf.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_char.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_hex.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_int.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_none.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_percent.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_ptr.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_str.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_uint.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/convert_written.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/extract.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/length_modifier.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/list.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/parse.c delete mode 100644 test_mini/libft/src/io/ft_printf/internals/utils.c delete mode 100644 test_mini/libft/src/io/ft_putchar.c delete mode 100644 test_mini/libft/src/io/ft_putchar_fd.c delete mode 100644 test_mini/libft/src/io/ft_putendl.c delete mode 100644 test_mini/libft/src/io/ft_putendl_fd.c delete mode 100644 test_mini/libft/src/io/ft_putnbr.c delete mode 100644 test_mini/libft/src/io/ft_putnbr_fd.c delete mode 100644 test_mini/libft/src/io/ft_putstr.c delete mode 100644 test_mini/libft/src/io/ft_putstr_fd.c delete mode 100644 test_mini/libft/src/lst/ft_lstbsearch.c delete mode 100644 test_mini/libft/src/lst/ft_lstdelone.c delete mode 100644 test_mini/libft/src/lst/ft_lstdestroy.c delete mode 100644 test_mini/libft/src/lst/ft_lstiter.c delete mode 100644 test_mini/libft/src/lst/ft_lstlast.c delete mode 100644 test_mini/libft/src/lst/ft_lstlfind.c delete mode 100644 test_mini/libft/src/lst/ft_lstlsearch.c delete mode 100644 test_mini/libft/src/lst/ft_lstmap.c delete mode 100644 test_mini/libft/src/lst/ft_lstnew.c delete mode 100644 test_mini/libft/src/lst/ft_lstpop_front.c delete mode 100644 test_mini/libft/src/lst/ft_lstpush_back.c delete mode 100644 test_mini/libft/src/lst/ft_lstpush_front.c delete mode 100644 test_mini/libft/src/lst/ft_lstremove_if.c delete mode 100644 test_mini/libft/src/lst/ft_lstreverse.c delete mode 100644 test_mini/libft/src/lst/ft_lstreverse_ret.c delete mode 100644 test_mini/libft/src/lst/ft_lstsize.c delete mode 100644 test_mini/libft/src/lst/ft_lstsort.c delete mode 100644 test_mini/libft/src/lst/ft_lstsorted_merge.c delete mode 100644 test_mini/libft/src/mem/ft_bzero.c delete mode 100644 test_mini/libft/src/mem/ft_calloc.c delete mode 100644 test_mini/libft/src/mem/ft_memalloc.c delete mode 100644 test_mini/libft/src/mem/ft_memccpy.c delete mode 100644 test_mini/libft/src/mem/ft_memchr.c delete mode 100644 test_mini/libft/src/mem/ft_memcmp.c delete mode 100644 test_mini/libft/src/mem/ft_memcpy.c delete mode 100644 test_mini/libft/src/mem/ft_memdel.c delete mode 100644 test_mini/libft/src/mem/ft_memmem.c delete mode 100644 test_mini/libft/src/mem/ft_memmove.c delete mode 100644 test_mini/libft/src/mem/ft_memset.c delete mode 100644 test_mini/libft/src/mem/ft_memset_pattern4.c delete mode 100644 test_mini/libft/src/mem/ft_memswap.c delete mode 100644 test_mini/libft/src/str/ft_atoi.c delete mode 100644 test_mini/libft/src/str/ft_atoi_strict.c delete mode 100644 test_mini/libft/src/str/ft_itoa.c delete mode 100644 test_mini/libft/src/str/ft_split.c delete mode 100644 test_mini/libft/src/str/ft_strcasecmp.c delete mode 100644 test_mini/libft/src/str/ft_strcat.c delete mode 100644 test_mini/libft/src/str/ft_strchr.c delete mode 100644 test_mini/libft/src/str/ft_strclr.c delete mode 100644 test_mini/libft/src/str/ft_strcmp.c delete mode 100644 test_mini/libft/src/str/ft_strcount.c delete mode 100644 test_mini/libft/src/str/ft_strcpy.c delete mode 100644 test_mini/libft/src/str/ft_strcspn.c delete mode 100644 test_mini/libft/src/str/ft_strdel.c delete mode 100644 test_mini/libft/src/str/ft_strdup.c delete mode 100644 test_mini/libft/src/str/ft_strequ.c delete mode 100644 test_mini/libft/src/str/ft_striter.c delete mode 100644 test_mini/libft/src/str/ft_striteri.c delete mode 100644 test_mini/libft/src/str/ft_strjoin.c delete mode 100644 test_mini/libft/src/str/ft_strjoin3.c delete mode 100644 test_mini/libft/src/str/ft_strjoinf.c delete mode 100644 test_mini/libft/src/str/ft_strlcat.c delete mode 100644 test_mini/libft/src/str/ft_strlcpy.c delete mode 100644 test_mini/libft/src/str/ft_strlen.c delete mode 100644 test_mini/libft/src/str/ft_strmap.c delete mode 100644 test_mini/libft/src/str/ft_strmapi.c delete mode 100644 test_mini/libft/src/str/ft_strncasecmp.c delete mode 100644 test_mini/libft/src/str/ft_strncat.c delete mode 100644 test_mini/libft/src/str/ft_strncmp.c delete mode 100644 test_mini/libft/src/str/ft_strncpy.c delete mode 100644 test_mini/libft/src/str/ft_strndup.c delete mode 100644 test_mini/libft/src/str/ft_strnequ.c delete mode 100644 test_mini/libft/src/str/ft_strnew.c delete mode 100644 test_mini/libft/src/str/ft_strnlen.c delete mode 100644 test_mini/libft/src/str/ft_strnstr.c delete mode 100644 test_mini/libft/src/str/ft_strpbrk.c delete mode 100644 test_mini/libft/src/str/ft_strrchr.c delete mode 100644 test_mini/libft/src/str/ft_strsep.c delete mode 100644 test_mini/libft/src/str/ft_strspn.c delete mode 100644 test_mini/libft/src/str/ft_strstr.c delete mode 100644 test_mini/libft/src/str/ft_strtol.c delete mode 100644 test_mini/libft/src/str/ft_strtolower.c delete mode 100644 test_mini/libft/src/str/ft_strtoupper.c delete mode 100644 test_mini/libft/src/str/ft_strtrim.c delete mode 100644 test_mini/libft/src/str/ft_substr.c delete mode 100644 test_mini/libft/src/util/ft_split_destroy.c delete mode 100644 test_mini/libft/src/vec/ft_vecdestroy.c delete mode 100644 test_mini/libft/src/vec/ft_vecgrow.c delete mode 100644 test_mini/libft/src/vec/ft_veciter.c delete mode 100644 test_mini/libft/src/vec/ft_vecnew.c delete mode 100644 test_mini/libft/src/vec/ft_vecpop.c delete mode 100644 test_mini/libft/src/vec/ft_vecpush.c delete mode 100644 test_mini/libft/src/vec/ft_vecremove.c (limited to 'test_mini/libft/src') diff --git a/test_mini/libft/src/algo/ft_bsearch.c b/test_mini/libft/src/algo/ft_bsearch.c deleted file mode 100644 index 5132fa2..0000000 --- a/test_mini/libft/src/algo/ft_bsearch.c +++ /dev/null @@ -1,32 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_bsearch.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/02/10 05:29:05 by cacharle #+# #+# */ -/* Updated: 2020/02/13 23:14:48 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft_algo.h" - -void *ft_bsearch(const void *base, size_t nel, size_t width, - t_ftsearch_const *consts) -{ - int res; - size_t mid; - - if (nel < 1) - return (NULL); - mid = nel / 2; - res = (consts->compar)(consts->key, base + mid * width); - if (res == 0) - return ((void*)base + mid * width); - if (res < 0) - return (ft_bsearch(base, mid, width, consts)); - else - return (ft_bsearch(base + (mid + 1) * width, nel - mid - 1, - width, consts)); -} diff --git a/test_mini/libft/src/algo/ft_compar_int.c b/test_mini/libft/src/algo/ft_compar_int.c deleted file mode 100644 index 848dc71..0000000 --- a/test_mini/libft/src/algo/ft_compar_int.c +++ /dev/null @@ -1,18 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_compar_int.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/01/19 08:24:43 by cacharle #+# #+# */ -/* Updated: 2020/01/19 08:27:38 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int ft_compar_int(const void *a, const void *b) -{ - return (*(int*)a - *(int*)b); -} diff --git a/test_mini/libft/src/algo/ft_heapsort.c b/test_mini/libft/src/algo/ft_heapsort.c deleted file mode 100644 index d309624..0000000 --- a/test_mini/libft/src/algo/ft_heapsort.c +++ /dev/null @@ -1,54 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_heapsort.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/02/10 02:59:22 by cacharle #+# #+# */ -/* Updated: 2020/02/10 04:22:19 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft_algo.h" - -/* static void st_build_max_heap(void *base, size_t nel, size_t width, */ -/* int (*compar)(const void *, const void *)) */ -/* { */ -/* int i; */ -/* */ -/* i = 1; */ -/* while (i < nel) */ -/* { */ -/* compar(base + i * width, base + 2 * i * width) */ -/* */ -/* i++; */ -/* } */ -/* } */ -/* */ -/* static void st_heapify(void *base, size_t nel, size_t width, */ -/* int (*compar)(const void *, const void *)) */ -/* { */ -/* */ -/* } */ - -int ft_heapsort(void *base, size_t nel, size_t width, - int (*compar)(const void *, const void *)) -{ - (void)base; - (void)nel; - (void)width; - (void)compar; - /* size_t i; */ - /* */ - /* if (nel < 2) */ - /* return (0); */ - /* st_build_max_heap(base, nel, width, compar); */ - /* i = -1; */ - /* while (++i < nel) */ - /* { */ - /* ft_memswap(base, base + (nel - i - 1) * width); */ - /* st_heapify(base, nel - i - 1, width, compar); */ - /* } */ - return (0); -} diff --git a/test_mini/libft/src/algo/ft_is_set.c b/test_mini/libft/src/algo/ft_is_set.c deleted file mode 100644 index 3e7ae31..0000000 --- a/test_mini/libft/src/algo/ft_is_set.c +++ /dev/null @@ -1,32 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_is_set.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/01/19 07:17:15 by cacharle #+# #+# */ -/* Updated: 2020/02/10 02:51:41 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" -#include "libft_algo.h" - -t_ftbool ft_is_set(void *base, size_t nel, size_t width, - t_ftcompar_func compar) -{ - size_t i; - - if (nel < 2) - return (TRUE); - ft_qsort(base, nel, width, compar); - i = 0; - while (i < nel - 1) - { - if (compar(base + (i * width), base + ((i + 1) * width)) == 0) - return (FALSE); - i++; - } - return (TRUE); -} diff --git a/test_mini/libft/src/algo/ft_lfind.c b/test_mini/libft/src/algo/ft_lfind.c deleted file mode 100644 index 8538f50..0000000 --- a/test_mini/libft/src/algo/ft_lfind.c +++ /dev/null @@ -1,28 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lfind.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/02/10 05:49:19 by cacharle #+# #+# */ -/* Updated: 2020/02/10 05:58:19 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft_algo.h" - -void *ft_lfind(const void *base, size_t *nelp, size_t width, - t_ftsearch_const *consts) -{ - size_t i; - - i = 0; - while (i < *nelp) - { - if ((consts->compar)(consts->key, base + i * width) == 0) - return ((void*)base + i * width); - i++; - } - return (NULL); -} diff --git a/test_mini/libft/src/algo/ft_lsearch.c b/test_mini/libft/src/algo/ft_lsearch.c deleted file mode 100644 index 4c77bca..0000000 --- a/test_mini/libft/src/algo/ft_lsearch.c +++ /dev/null @@ -1,23 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lsearch.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/02/10 05:53:57 by cacharle #+# #+# */ -/* Updated: 2020/02/10 05:59:33 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft_algo.h" - -void *ft_lsearch(const void *base, size_t *nelp, size_t width, - t_ftsearch_const *consts) -{ - void *found; - - if ((found = ft_lfind(base, nelp, width, consts)) != NULL) - return (found); - return (ft_memcpy((void*)base + (*nelp)++ * width, consts->key, width)); -} diff --git a/test_mini/libft/src/algo/ft_mergesort.c b/test_mini/libft/src/algo/ft_mergesort.c deleted file mode 100644 index 25b4255..0000000 --- a/test_mini/libft/src/algo/ft_mergesort.c +++ /dev/null @@ -1,76 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_mergesort.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/02/10 02:26:41 by cacharle #+# #+# */ -/* Updated: 2020/02/13 23:14:21 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft_algo.h" - -static int st_mergesort_error(void *left, void *right) -{ - free(left); - free(right); - return (-1); -} - -static void st_merge_sorted(struct s_merge_sorted_arrays *arrays, size_t nel, - size_t width, int (*compar)(const void *, const void *)) -{ - size_t bi; - size_t li; - size_t ri; - size_t mid; - - mid = nel / 2; - bi = 0; - li = 0; - ri = 0; - while (li < mid && ri < nel - mid) - { - if (compar(arrays->left + li * width, arrays->right + ri * width) < 0) - ft_memcpy(arrays->base + bi * width, - arrays->left + li++ * width, width); - else - ft_memcpy(arrays->base + bi * width, - arrays->right + ri++ * width, width); - bi++; - } - while (li < mid) - ft_memcpy(arrays->base + bi++ * width, - arrays->left + li++ * width, width); - while (ri < nel - mid) - ft_memcpy(arrays->base + bi++ * width, - arrays->right + ri++ * width, width); -} - -int ft_mergesort(void *base, size_t nel, size_t width, - int (*compar)(const void *, const void *)) -{ - size_t mid; - struct s_merge_sorted_arrays arrays; - - if (nel < 2) - return (0); - mid = nel / 2; - if ((arrays.left = malloc(mid * width)) == NULL) - return (-1); - if ((arrays.right = malloc((nel - mid) * width)) == NULL) - return (st_mergesort_error(arrays.left, NULL)); - ft_memcpy(arrays.left, base, mid * width); - ft_memcpy(arrays.right, base + mid * width, (nel - mid) * width); - if (ft_mergesort(arrays.left, mid, width, compar) == -1) - return (st_mergesort_error(arrays.left, arrays.right)); - if (ft_mergesort(arrays.right, nel - mid, width, compar) == -1) - return (st_mergesort_error(arrays.left, arrays.right)); - arrays.base = base; - st_merge_sorted(&arrays, nel, width, compar); - free(arrays.left); - free(arrays.right); - return (0); -} diff --git a/test_mini/libft/src/algo/ft_qsort.c b/test_mini/libft/src/algo/ft_qsort.c deleted file mode 100644 index 9bcfcdf..0000000 --- a/test_mini/libft/src/algo/ft_qsort.c +++ /dev/null @@ -1,64 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_qsort.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/01/19 07:25:51 by cacharle #+# #+# */ -/* Updated: 2020/02/10 02:55:14 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft_algo.h" - -static t_ftrange ft_range_new(int lo, int hi) -{ - t_ftrange range; - - range.lo = lo; - range.hi = hi; - return (range); -} - -static int ft_qsort_partition(void *base, t_ftrange range, - size_t width, t_ftcompar_func compar) -{ - void *pivot; - int p; - int i; - - pivot = base + (range.hi * width); - p = range.lo; - i = range.lo - 1; - while (++i < range.hi) - { - if (compar(base + (i * width), pivot) < 0) - { - ft_memswap(base + (i * width), base + (p * width), width); - p++; - } - } - ft_memswap(pivot, base + (p * width), width); - return (p); -} - -static void ft_qsort_rec(void *base, t_ftrange range, - size_t width, t_ftcompar_func compar) -{ - int pivot; - - if (range.lo >= range.hi) - return ; - pivot = ft_qsort_partition(base, range, width, compar); - ft_qsort_rec(base, ft_range_new(range.lo, pivot - 1), width, compar); - ft_qsort_rec(base, ft_range_new(pivot + 1, range.hi), width, compar); -} - -void ft_qsort(void *base, size_t nel, size_t width, - t_ftcompar_func compar) -{ - if (width == 0 || nel < 2) - return ; - ft_qsort_rec(base, ft_range_new(0, nel - 1), width, compar); -} diff --git a/test_mini/libft/src/algo/ft_reverse.c b/test_mini/libft/src/algo/ft_reverse.c deleted file mode 100644 index 0bc447f..0000000 --- a/test_mini/libft/src/algo/ft_reverse.c +++ /dev/null @@ -1,27 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_reverse.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/02/10 05:07:13 by cacharle #+# #+# */ -/* Updated: 2020/02/10 05:19:22 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft_algo.h" - -void ft_reverse(void *base, size_t nel, size_t width) -{ - size_t i; - - i = 0; - nel--; - while (i < nel) - { - ft_memswap(base + i * width, base + nel * width, width); - i++; - nel--; - } -} diff --git a/test_mini/libft/src/bt/ft_btdestroy.c b/test_mini/libft/src/bt/ft_btdestroy.c deleted file mode 100644 index c802db0..0000000 --- a/test_mini/libft/src/bt/ft_btdestroy.c +++ /dev/null @@ -1,23 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_btdestroy.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/02/07 21:30:53 by cacharle #+# #+# */ -/* Updated: 2020/02/07 21:35:19 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft_bt.h" - -void ft_btdestroy(t_ftbtree *tree, void (*del)(void *data)) -{ - if (tree == NULL) - return ; - ft_btdestroy(tree->left, del); - ft_btdestroy(tree->right, del); - (*del)(tree->data); - free(tree); -} diff --git a/test_mini/libft/src/bt/ft_btnew.c b/test_mini/libft/src/bt/ft_btnew.c deleted file mode 100644 index 973e1a4..0000000 --- a/test_mini/libft/src/bt/ft_btnew.c +++ /dev/null @@ -1,25 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_btnew.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/02/07 21:33:16 by cacharle #+# #+# */ -/* Updated: 2020/02/07 21:34:35 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft_bt.h" - -t_ftbtree *ft_btnew(void *data) -{ - t_ftbtree *tree; - - if ((tree = (t_ftbtree*)malloc(sizeof(t_ftbtree))) == NULL) - return (NULL); - tree->data = data; - tree->left = NULL; - tree->right = NULL; - return (tree); -} diff --git a/test_mini/libft/src/ctype/ft_isalnum.c b/test_mini/libft/src/ctype/ft_isalnum.c deleted file mode 100644 index 1ee1e0f..0000000 --- a/test_mini/libft/src/ctype/ft_isalnum.c +++ /dev/null @@ -1,18 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isalnum.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2019/10/07 09:41:40 by cacharle #+# #+# */ -/* Updated: 2019/10/07 09:41:56 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int ft_isalnum(int c) -{ - return (ft_isalpha(c) || ft_isdigit(c)); -} diff --git a/test_mini/libft/src/ctype/ft_isalpha.c b/test_mini/libft/src/ctype/ft_isalpha.c deleted file mode 100644 index 6f155b4..0000000 --- a/test_mini/libft/src/ctype/ft_isalpha.c +++ /dev/null @@ -1,16 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isalpha.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2019/10/07 09:54:52 by cacharle #+# #+# */ -/* Updated: 2019/10/20 13:01:13 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -int ft_isalpha(int c) -{ - return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); -} diff --git a/test_mini/libft/src/ctype/ft_isascii.c b/test_mini/libft/src/ctype/ft_isascii.c deleted file mode 100644 index 12b6849..0000000 --- a/test_mini/libft/src/ctype/ft_isascii.c +++ /dev/null @@ -1,16 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isascii.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2019/10/07 09:54:30 by cacharle #+# #+# */ -/* Updated: 2020/02/12 23:01:02 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -int ft_isascii(int c) -{ - return (c >= 00 && c <= 0177); -} diff --git a/test_mini/libft/src/ctype/ft_isblank.c b/test_mini/libft/src/ctype/ft_isblank.c deleted file mode 100644 index def106b..0000000 --- a/test_mini/libft/src/ctype/ft_isblank.c +++ /dev/null @@ -1,16 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isblank.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/02/10 05:17:45 by cacharle #+# #+# */ -/* Updated: 2020/02/10 05:18:34 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -int ft_isblank(int c) -{ - return (c == ' ' || c == '\t'); -} diff --git a/test_mini/libft/src/ctype/ft_isdigit.c b/test_mini/libft/src/ctype/ft_isdigit.c deleted file mode 100644 index f8a5850..0000000 --- a/test_mini/libft/src/ctype/ft_isdigit.c +++ /dev/null @@ -1,16 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isdigit.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2019/10/07 10:41:20 by cacharle #+# #+# */ -/* Updated: 2019/10/07 10:41:25 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -int ft_isdigit(int c) -{ - return (c >= '0' && c <= '9'); -} diff --git a/test_mini/libft/src/ctype/ft_isprint.c b/test_mini/libft/src/ctype/ft_isprint.c deleted file mode 100644 index c311709..0000000 --- a/test_mini/libft/src/ctype/ft_isprint.c +++ /dev/null @@ -1,16 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isprint.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2019/10/07 09:52:09 by cacharle #+# #+# */ -/* Updated: 2019/10/20 13:03:36 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -int ft_isprint(int c) -{ - return (c >= ' ' && c <= '~'); -} diff --git a/test_mini/libft/src/ctype/ft_isspace.c b/test_mini/libft/src/ctype/ft_isspace.c deleted file mode 100644 index 18b6dba..0000000 --- a/test_mini/libft/src/ctype/ft_isspace.c +++ /dev/null @@ -1,19 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isspace.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/01/15 11:33:36 by cacharle #+# #+# */ -/* Updated: 2020/01/15 11:35:07 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int ft_isspace(int c) -{ - return (c == ' ' || c == '\t' || c == '\n' - || c == '\v' || c == '\f' || c == '\r'); -} diff --git a/test_mini/libft/src/ctype/ft_todigit.c b/test_mini/libft/src/ctype/ft_todigit.c deleted file mode 100644 index f201470..0000000 --- a/test_mini/libft/src/ctype/ft_todigit.c +++ /dev/null @@ -1,20 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_todigit.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/01/15 10:37:57 by cacharle #+# #+# */ -/* Updated: 2020/02/12 23:11:55 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int ft_todigit(int c) -{ - if (!ft_isdigit(c)) - return (-1); - return (c & 0x0F); -} diff --git a/test_mini/libft/src/ctype/ft_tolower.c b/test_mini/libft/src/ctype/ft_tolower.c deleted file mode 100644 index 919469f..0000000 --- a/test_mini/libft/src/ctype/ft_tolower.c +++ /dev/null @@ -1,24 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_tolower.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2019/10/07 10:14:26 by cacharle #+# #+# */ -/* Updated: 2019/11/20 01:04:02 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -/* -** E: 0100 0101 -** e: 0110 0101 -** ^ -*/ - -int ft_tolower(int c) -{ - if (c >= 'A' && c <= 'Z') - return (c | 0b00100000); - return (c); -} diff --git a/test_mini/libft/src/ctype/ft_toupper.c b/test_mini/libft/src/ctype/ft_toupper.c deleted file mode 100644 index 8579b91..0000000 --- a/test_mini/libft/src/ctype/ft_toupper.c +++ /dev/null @@ -1,20 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_toupper.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2019/10/07 10:14:10 by cacharle #+# #+# */ -/* Updated: 2019/11/20 01:04:51 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" - -int ft_toupper(int c) -{ - if (c >= 'a' && c <= 'z') - return (c ^ 0b00100000); - return (c); -} diff --git a/test_mini/libft/src/ht/ft_htdelone.c b/test_mini/libft/src/ht/ft_htdelone.c deleted file mode 100644 index 7374a44..0000000 --- a/test_mini/libft/src/ht/ft_htdelone.c +++ /dev/null @@ -1,29 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_htdelone.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/01/30 09:27:18 by cacharle #+# #+# */ -/* Updated: 2020/02/28 12:10:16 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" -#include "libft_ht.h" - -/* -** \brief Delete one hash table entry -** \param key Key of entry to delete -** \param del Function to destroy the entry -** \warning The del function HAS to free the key -** \note Do nothing if their is to entry which correspond to key -*/ - -void ft_htdelone(t_ftht *ht, char *key, void (*del)(t_ftht_entry*)) -{ - ft_lstremove_if(ht->buckets + ft_hthash(ht, key), - ft_inter_htkey_cmp, key, - (void (*)(void*))del); -} diff --git a/test_mini/libft/src/ht/ft_htdestroy.c b/test_mini/libft/src/ht/ft_htdestroy.c deleted file mode 100644 index ff362d2..0000000 --- a/test_mini/libft/src/ht/ft_htdestroy.c +++ /dev/null @@ -1,30 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_htdestroy.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/01/30 08:31:02 by cacharle #+# #+# */ -/* Updated: 2020/02/28 12:10:31 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" -#include "libft_ht.h" - -/* -** \brief Destroy an hash table. -** \param del Function to delete each entry -** \warning The del function HAS to free the key -*/ - -void ft_htdestroy(t_ftht *ht, void (*del)(t_ftht_entry*)) -{ - if (ht == NULL) - return ; - while (ht->size-- > 0) - ft_lstdestroy(ht->buckets + ht->size, (void (*)(void*))del); - free(ht->buckets); - free(ht); -} diff --git a/test_mini/libft/src/ht/ft_htentry_new.c b/test_mini/libft/src/ht/ft_htentry_new.c deleted file mode 100644 index 12a1159..0000000 --- a/test_mini/libft/src/ht/ft_htentry_new.c +++ /dev/null @@ -1,37 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_htentry_new.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/01/30 08:45:36 by cacharle #+# #+# */ -/* Updated: 2020/02/17 04:09:50 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" -#include "libft_ht.h" - -/* -** \brief Create a new hash table key/value pair. -** \param key Hash entry string key (always duplicated) -** \return Content or NULL if an allocation failed. -*/ - -t_ftht_entry *ft_htentry_new(char *key, void *value) -{ - t_ftht_entry *content; - - if (key == NULL) - return (NULL); - if ((content = (t_ftht_entry*)malloc(sizeof(t_ftht_entry))) == NULL) - return (NULL); - if ((content->key = ft_strdup(key)) == NULL) - { - free(content); - return (NULL); - } - content->value = value; - return (content); -} diff --git a/test_mini/libft/src/ht/ft_htget.c b/test_mini/libft/src/ht/ft_htget.c deleted file mode 100644 index a6383fe..0000000 --- a/test_mini/libft/src/ht/ft_htget.c +++ /dev/null @@ -1,35 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_htget.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/01/30 08:33:21 by cacharle #+# #+# */ -/* Updated: 2020/04/01 18:02:57 by charles ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" -#include "libft_ht.h" - -/* -** \brief Retrieve a value with a key -** \param ht Hash table where key is searched -** \param key Searched key -** \return Value void pointer at key or NULL if not found -*/ - -void *ft_htget(t_ftht *ht, char *key) -{ - t_ftht_digest digest; - t_ftlst *found; - - if (ht == NULL || key == NULL) - return (NULL); - digest = ft_hthash(ht, key); - found = ft_lstlfind(ht->buckets[digest], ft_inter_htkey_cmp, key); - if (found == NULL) - return (NULL); - return (((t_ftht_entry*)found->data)->value); -} diff --git a/test_mini/libft/src/ht/ft_hthash.c b/test_mini/libft/src/ht/ft_hthash.c deleted file mode 100644 index 3369d24..0000000 --- a/test_mini/libft/src/ht/ft_hthash.c +++ /dev/null @@ -1,36 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_hthash.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/01/30 09:56:01 by cacharle #+# #+# */ -/* Updated: 2020/01/30 10:34:27 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft_ht.h" - -/* -** \brief Hash a string -** \param ht So that the index is in the hash table bound -** \param key String to hash -** \return Hash -*/ - -// maybe use a less efficient but understandable function -t_ftht_digest ft_hthash(t_ftht *ht, char *key) -{ - t_ftht_digest digest; - - if (*key == '\0') - return (0); - digest = *key++ << 7; - while (*key != '\0') - { - digest = ((1000003 * digest) ^ *key) & (1 << 16); - key++; - } - return (digest % ht->size); -} diff --git a/test_mini/libft/src/ht/ft_htiter.c b/test_mini/libft/src/ht/ft_htiter.c deleted file mode 100644 index b854993..0000000 --- a/test_mini/libft/src/ht/ft_htiter.c +++ /dev/null @@ -1,31 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_htiter.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: charles +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/04/01 18:02:24 by charles #+# #+# */ -/* Updated: 2020/04/01 18:02:32 by charles ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft_ht.h" - -/* -** \brief Iterate over entry of hash table -** \param ht Iterated hash table -** \param f Function applied to each entry -*/ - -void ft_htiter(t_ftht *ht, void (*f)(t_ftht_entry*)) -{ - size_t i; - - i = 0; - while (i < ht->size) - { - ft_lstiter(ht->buckets[i], (void (*)(void*))f); - i++; - } -} diff --git a/test_mini/libft/src/ht/ft_htnew.c b/test_mini/libft/src/ht/ft_htnew.c deleted file mode 100644 index e5335d2..0000000 --- a/test_mini/libft/src/ht/ft_htnew.c +++ /dev/null @@ -1,38 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_htnew.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/01/30 08:19:16 by cacharle #+# #+# */ -/* Updated: 2020/02/28 12:23:43 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" -#include "libft_ht.h" - -/* -** \brief Create a new hash table. -** \param size Size of the underlying array of linked list (buckets) -** \return Created hash table or NULL is an allocation failed -*/ - -t_ftht *ft_htnew(t_ftsize size) -{ - t_ftht *ht; - - if (size == 0) - return (NULL); - if ((ht = (t_ftht*)malloc(sizeof(t_ftht))) == NULL) - return (NULL); - ht->buckets = (t_ftht_bucket*)ft_calloc(size, sizeof(t_ftht_entry)); - if (ht->buckets == NULL) - { - free(ht); - return (NULL); - } - ht->size = size; - return (ht); -} diff --git a/test_mini/libft/src/ht/ft_htset.c b/test_mini/libft/src/ht/ft_htset.c deleted file mode 100644 index 68d3752..0000000 --- a/test_mini/libft/src/ht/ft_htset.c +++ /dev/null @@ -1,56 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_htset.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/01/30 08:41:52 by cacharle #+# #+# */ -/* Updated: 2020/04/01 18:02:12 by charles ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" -#include "libft_ht.h" - -/* -** \brief Create/Update a entry in hash table. -** \note If `key` already exist in `ht` -** only updates the list node content. -** Else create a new list node in addition the list content. -** \param ht Hash table where the entry is modified -** \param key Key of the new entry -** \param value Value of the new entry -** \param del Destroy function in case the entry is modified. -** \return Pointer to the created entry, NULL if an allocation failed. -*/ - -t_ftht_entry *ft_htset(t_ftht *ht, char *key, void *value, - void (*del)(t_ftht_entry*)) -{ - t_ftht_digest digest; - t_ftht_entry *content; - t_ftht_bucket bucket; - t_ftlst *tmp; - - if (ht == NULL || key == NULL) - return (NULL); - if ((content = ft_htentry_new(key, value)) == NULL) - return (NULL); - digest = ft_hthash(ht, key); - tmp = ft_lstlfind(ht->buckets[digest], ft_inter_htkey_cmp, key); - if (tmp != NULL) - { - if (del != NULL) - del(tmp->data); - tmp->data = content; - return ((t_ftht_entry*)tmp->data); - } - if ((bucket = ft_lstnew(content)) == NULL) - { - del(content); - return (NULL); - } - ft_lstpush_front(ht->buckets + digest, bucket); - return (content); -} diff --git a/test_mini/libft/src/ht/ft_inter_htkey_cmp.c b/test_mini/libft/src/ht/ft_inter_htkey_cmp.c deleted file mode 100644 index e8a0375..0000000 --- a/test_mini/libft/src/ht/ft_inter_htkey_cmp.c +++ /dev/null @@ -1,25 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_internal_htkey_equal.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/01/30 09:24:39 by cacharle #+# #+# */ -/* Updated: 2020/02/28 12:20:43 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "libft.h" -#include "libft_ht.h" - -/* -** Hash table internal function to compare key string in linked list. -*/ - -int ft_inter_htkey_cmp(const void *ref_key, const void *content) -{ - if (ref_key == NULL || content == NULL) - return (-1); - return (ft_strcmp((char*)ref_key, ((t_ftht_entry*)content)->key)); -} diff --git a/test_mini/libft/src/io/ft_getchar.c b/test_mini/libft/src/io/ft_getchar.c deleted file mode 100644 index 9d233c0..0000000 --- a/test_mini/libft/src/io/ft_getchar.c +++ /dev/null @@ -1,22 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_getchar.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle +#+ +:+ +#+ */ -/*