diff options
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | Makefile | 10 | ||||
| -rw-r--r-- | include/libft_ht.h | 10 | ||||
| -rw-r--r-- | include/libft_lst.h | 6 | ||||
| -rw-r--r-- | src/ht/ft_htdelone.c | 2 | ||||
| -rw-r--r-- | src/ht/ft_htdestroy.c | 2 | ||||
| -rw-r--r-- | src/ht/ft_htentry_new.c | 2 | ||||
| -rw-r--r-- | src/ht/ft_htget.c | 5 | ||||
| -rw-r--r-- | src/ht/ft_hthash.c | 2 | ||||
| -rw-r--r-- | src/ht/ft_htiter.c | 14 | ||||
| -rw-r--r-- | src/ht/ft_htnew.c | 2 | ||||
| -rw-r--r-- | src/ht/ft_htset.c | 7 | ||||
| -rw-r--r-- | src/lst/ft_lstdelone.c | 2 | ||||
| -rw-r--r-- | src/lst/ft_lstdestroy.c | 2 | ||||
| -rw-r--r-- | src/lst/ft_lstiter.c | 2 | ||||
| -rw-r--r-- | src/lst/ft_lstlast.c | 2 | ||||
| -rw-r--r-- | src/lst/ft_lstmap.c | 2 | ||||
| -rw-r--r-- | src/lst/ft_lstnew.c | 2 | ||||
| -rw-r--r-- | src/lst/ft_lstpop_front.c | 2 | ||||
| -rw-r--r-- | src/lst/ft_lstpush_back.c | 2 | ||||
| -rw-r--r-- | src/lst/ft_lstpush_front.c | 2 | ||||
| -rw-r--r-- | src/lst/ft_lstremove_if.c | 2 | ||||
| -rw-r--r-- | src/lst/ft_lstreverse.c | 2 | ||||
| -rw-r--r-- | src/lst/ft_lstreverse_ret.c | 2 | ||||
| -rw-r--r-- | src/lst/ft_lstsize.c | 2 | ||||
| -rw-r--r-- | src/lst/ft_lstsort.c | 2 | ||||
| -rw-r--r-- | src/lst/ft_lstsorted_merge.c | 2 | ||||
| -rw-r--r-- | src/str/ft_atoi.c | 2 | ||||
| -rw-r--r-- | src/str/ft_strjoin3.c | 20 | ||||
| -rwxr-xr-x | test/libft_test | bin | 127848 -> 0 bytes |
30 files changed, 78 insertions, 39 deletions
@@ -4,7 +4,8 @@ *.ghc *.dSYM a.out -test_libft +test/libft_test obj/* rendu.makefile doc/* +tmp/* @@ -6,7 +6,7 @@ # By: cacharle <marvin@42.fr> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2019/10/08 15:45:53 by cacharle #+# #+# # -# Updated: 2020/02/28 12:08:33 by cacharle ### ########.fr # +# Updated: 2020/04/01 18:09:04 by charles ### ########.fr # # # # **************************************************************************** # @@ -27,8 +27,10 @@ DOC_DIR = doc INCLUDE_DIR = include + CC = gcc -CCFLAGS = -I$(INCLUDE_DIR) -Wall -Wextra -Werror +OFLAG ?= -O1 +CCFLAGS = $(OFLAG) -I$(INCLUDE_DIR) -Wall -Wextra -Werror IGNORE_FILE = .libftignore IGNORE_DEFAULT = ft_printf @@ -81,8 +83,12 @@ fclean: clean re: fclean all +.PHONY: doc doc: + mkdir -p tmp + for f in $(SRC) $(INCLUDE); do mkdir -p tmp/`dirname $$f` && sed 's_^/\*$$_/**_' $$f > tmp/$$f; done $(DOXYGEN) $(DOXYGEN_FILE) doc_clean: $(RM) -r $(DOC_DIR) + diff --git a/include/libft_ht.h b/include/libft_ht.h index 24abf95..10c6fc7 100644 --- a/include/libft_ht.h +++ b/include/libft_ht.h @@ -6,14 +6,14 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/31 10:36:09 by cacharle #+# #+# */ -/* Updated: 2020/02/28 12:18:19 by cacharle ### ########.fr */ +/* Updated: 2020/04/01 17:59:35 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef LIBFT_HT_H # define LIBFT_HT_H -/** +/* ** \file libft_ht.h ** \brief Hash table manipulation */ @@ -21,7 +21,7 @@ # include "libft.h" # include "libft_lst.h" -/** +/* ** \brief Hash table entry, key/value pair ** \param key String key ** \param value Pointer to data @@ -35,7 +35,7 @@ typedef struct s_ftht_entry typedef t_ftlst* t_ftht_bucket; -/** +/* ** \brief Hash table struct ** \param size Number of buckets ** \param buckets Bucket array @@ -59,7 +59,7 @@ t_ftht_entry *ft_htset(t_ftht *ht, char *key, void *value, void ft_htdelone(t_ftht *ht, char *key, void (*del)(t_ftht_entry*)); t_ftht_entry *ft_htentry_new(char *key, void *value); -void ft_htiter(t_ftht *ht, void (*f)(t_ftht_entry*)); +void ft_htiter(t_ftht *ht, void (*f)(t_ftht_entry*)); /* ** internals diff --git a/include/libft_lst.h b/include/libft_lst.h index 04b1dbf..d7157a9 100644 --- a/include/libft_lst.h +++ b/include/libft_lst.h @@ -6,14 +6,14 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/31 10:36:39 by cacharle #+# #+# */ -/* Updated: 2020/02/28 12:23:31 by cacharle ### ########.fr */ +/* Updated: 2020/04/01 17:59:50 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef LIBFT_LST_H # define LIBFT_LST_H -/** +/* ** \file libft_lst.h ** \brief Linked list Manipulation */ @@ -22,7 +22,7 @@ # include "libft_types.h" # include "libft_algo.h" -/** +/* ** \brief List struct ** \param data Pointer to node data ** \param next Pointer to next node or NULL if last node diff --git a/src/ht/ft_htdelone.c b/src/ht/ft_htdelone.c index 3672b23..7374a44 100644 --- a/src/ht/ft_htdelone.c +++ b/src/ht/ft_htdelone.c @@ -13,7 +13,7 @@ #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 diff --git a/src/ht/ft_htdestroy.c b/src/ht/ft_htdestroy.c index ef4b257..ff362d2 100644 --- a/src/ht/ft_htdestroy.c +++ b/src/ht/ft_htdestroy.c @@ -13,7 +13,7 @@ #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 diff --git a/src/ht/ft_htentry_new.c b/src/ht/ft_htentry_new.c index 03c0980..12a1159 100644 --- a/src/ht/ft_htentry_new.c +++ b/src/ht/ft_htentry_new.c @@ -13,7 +13,7 @@ #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. diff --git a/src/ht/ft_htget.c b/src/ht/ft_htget.c index 6b5df48..a6383fe 100644 --- a/src/ht/ft_htget.c +++ b/src/ht/ft_htget.c @@ -6,14 +6,14 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/30 08:33:21 by cacharle #+# #+# */ -/* Updated: 2020/02/28 12:21:09 by cacharle ### ########.fr */ +/* 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 @@ -22,7 +22,6 @@ void *ft_htget(t_ftht *ht, char *key) { - t_ftht_digest digest; t_ftlst *found; diff --git a/src/ht/ft_hthash.c b/src/ht/ft_hthash.c index 2670e31..3369d24 100644 --- a/src/ht/ft_hthash.c +++ b/src/ht/ft_hthash.c @@ -12,7 +12,7 @@ #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 diff --git a/src/ht/ft_htiter.c b/src/ht/ft_htiter.c index e5ab2eb..b854993 100644 --- a/src/ht/ft_htiter.c +++ b/src/ht/ft_htiter.c @@ -1,6 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_htiter.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* 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 diff --git a/src/ht/ft_htnew.c b/src/ht/ft_htnew.c index e28b544..e5335d2 100644 --- a/src/ht/ft_htnew.c +++ b/src/ht/ft_htnew.c @@ -13,7 +13,7 @@ #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 diff --git a/src/ht/ft_htset.c b/src/ht/ft_htset.c index 9738c14..68d3752 100644 --- a/src/ht/ft_htset.c +++ b/src/ht/ft_htset.c @@ -6,16 +6,17 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/30 08:41:52 by cacharle #+# #+# */ -/* Updated: 2020/02/28 12:11:00 by cacharle ### ########.fr */ +/* 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. +** \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 diff --git a/src/lst/ft_lstdelone.c b/src/lst/ft_lstdelone.c index 40e25cd..3dfbbbb 100644 --- a/src/lst/ft_lstdelone.c +++ b/src/lst/ft_lstdelone.c @@ -12,7 +12,7 @@ #include "libft_lst.h" -/** +/* ** \brief Delete list node ** \param del Delete function for node's data */ diff --git a/src/lst/ft_lstdestroy.c b/src/lst/ft_lstdestroy.c index 5e55f04..35da2a5 100644 --- a/src/lst/ft_lstdestroy.c +++ b/src/lst/ft_lstdestroy.c @@ -12,7 +12,7 @@ #include "libft_lst.h" -/** +/* ** \brief Destroy a list and set his pointer to NULL ** \param del Delete Function for data of each node */ diff --git a/src/lst/ft_lstiter.c b/src/lst/ft_lstiter.c index 39d870b..e46b507 100644 --- a/src/lst/ft_lstiter.c +++ b/src/lst/ft_lstiter.c @@ -12,7 +12,7 @@ #include "libft_lst.h" -/** +/* ** \brief Iterate of list ** \param f Funtion applied to data of each node */ diff --git a/src/lst/ft_lstlast.c b/src/lst/ft_lstlast.c index 12fdeee..97b853d 100644 --- a/src/lst/ft_lstlast.c +++ b/src/lst/ft_lstlast.c @@ -12,7 +12,7 @@ #include "libft_lst.h" -/** +/* ** \brief Last node ** \return List's last node */ diff --git a/src/lst/ft_lstmap.c b/src/lst/ft_lstmap.c index bf96892..3182bb0 100644 --- a/src/lst/ft_lstmap.c +++ b/src/lst/ft_lstmap.c @@ -12,7 +12,7 @@ #include "libft_lst.h" -/** +/* ** \brief Clone a list and map a function to each node data ** \param lst Origin list ** \param f Function applied to each node's data diff --git a/src/lst/ft_lstnew.c b/src/lst/ft_lstnew.c index 41c8153..1616b71 100644 --- a/src/lst/ft_lstnew.c +++ b/src/lst/ft_lstnew.c @@ -12,7 +12,7 @@ #include "libft_lst.h" -/** +/* ** \brief Create a list node ** \param data Pointer to data of node */ diff --git a/src/lst/ft_lstpop_front.c b/src/lst/ft_lstpop_front.c index 798bf83..a61350a 100644 --- a/src/lst/ft_lstpop_front.c +++ b/src/lst/ft_lstpop_front.c @@ -12,7 +12,7 @@ #include "libft_lst.h" -/** +/* ** \brief Delete head node and replace it with next node ** \param del Delete function for node data */ diff --git a/src/lst/ft_lstpush_back.c b/src/lst/ft_lstpush_back.c index 372c18c..1dca078 100644 --- a/src/lst/ft_lstpush_back.c +++ b/src/lst/ft_lstpush_back.c @@ -12,7 +12,7 @@ #include "libft_lst.h" -/** +/* ** \brief Push new node to the list end ** \param new Pushed node */ diff --git a/src/lst/ft_lstpush_front.c b/src/lst/ft_lstpush_front.c index c17a586..85df649 100644 --- a/src/lst/ft_lstpush_front.c +++ b/src/lst/ft_lstpush_front.c @@ -12,7 +12,7 @@ #include "libft_lst.h" -/** +/* ** \brief Push node to list front ** \param new Pushed node */ diff --git a/src/lst/ft_lstremove_if.c b/src/lst/ft_lstremove_if.c index fdac710..4070355 100644 --- a/src/lst/ft_lstremove_if.c +++ b/src/lst/ft_lstremove_if.c @@ -12,7 +12,7 @@ #include "libft_lst.h" -/** +/* ** \brief Remove node on some condition ** \param cmp Comparison function, return 0 if equal ** \param ref Reference data passed has the first arg of `cmp` diff --git a/src/lst/ft_lstreverse.c b/src/lst/ft_lstreverse.c index fd5259b..7c2778d 100644 --- a/src/lst/ft_lstreverse.c +++ b/src/lst/ft_lstreverse.c @@ -12,7 +12,7 @@ #include "libft_lst.h" -/** +/* ** \brief Reverse a list */ diff --git a/src/lst/ft_lstreverse_ret.c b/src/lst/ft_lstreverse_ret.c index 259af9e..36c0c5c 100644 --- a/src/lst/ft_lstreverse_ret.c +++ b/src/lst/ft_lstreverse_ret.c @@ -12,7 +12,7 @@ #include "libft_lst.h" -/** +/* ** \brief Reverse list ** \return Pointer to reversed list */ diff --git a/src/lst/ft_lstsize.c b/src/lst/ft_lstsize.c index 6a92b99..3c6956b 100644 --- a/src/lst/ft_lstsize.c +++ b/src/lst/ft_lstsize.c @@ -12,7 +12,7 @@ #include "libft_lst.h" -/** +/* ** \brief List size ** \return Number of node in list */ diff --git a/src/lst/ft_lstsort.c b/src/lst/ft_lstsort.c index fbd046a..9945a0f 100644 --- a/src/lst/ft_lstsort.c +++ b/src/lst/ft_lstsort.c @@ -12,7 +12,7 @@ #include "libft_lst.h" -/** +/* ** \brief Sort list ** \param cmp Comparison function, <0 if less, 0 if equal, >0 if greater ** \note Use merge sort algorithm diff --git a/src/lst/ft_lstsorted_merge.c b/src/lst/ft_lstsorted_merge.c index 0cd5721..995785f 100644 --- a/src/lst/ft_lstsorted_merge.c +++ b/src/lst/ft_lstsorted_merge.c @@ -12,7 +12,7 @@ #include "libft_lst.h" -/** +/* ** \brief Merge sorted lists, the new list is also sorted ** \param l1 First list ** \param l2 Second list diff --git a/src/str/ft_atoi.c b/src/str/ft_atoi.c index 1b9bfc4..d6fa5bb 100644 --- a/src/str/ft_atoi.c +++ b/src/str/ft_atoi.c @@ -12,7 +12,7 @@ #include "libft.h" -/** +/* ** Convert a string to an int */ diff --git a/src/str/ft_strjoin3.c b/src/str/ft_strjoin3.c index 69de060..e5e5530 100644 --- a/src/str/ft_strjoin3.c +++ b/src/str/ft_strjoin3.c @@ -1,5 +1,25 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strjoin3.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/04/01 18:00:49 by charles #+# #+# */ +/* Updated: 2020/04/01 18:01:43 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "libft.h" +/* +** \brief Join 3 strings in a new malloc'd one +** \param s1 String 1 +** \param s2 String 2 +** \param s3 String 3 +** \return The joined string +*/ + char *ft_strjoin3(char const *s1, char const *s2, char const *s3) { char *joined; diff --git a/test/libft_test b/test/libft_test Binary files differdeleted file mode 100755 index b5c1a5e..0000000 --- a/test/libft_test +++ /dev/null |
