diff --git a/.Makefile.swn b/.Makefile.swn index 94cb7a0..960de40 100644 Binary files a/.Makefile.swn and b/.Makefile.swn differ diff --git a/Makefile b/Makefile index c4b9a2a..22f712f 100644 --- a/Makefile +++ b/Makefile @@ -55,15 +55,15 @@ SRCS = ft_memset.c \ ODIR = ./builds OBJS = $(SRCS:%.c=$(ODIR)/%.o) -SRCB = ft_lstnew.c \ #fonction un peu changee - ft_lstadd.c \ #ft_lstadd_front.c - ft_lstsize \ #a creer - ft_lstlast \ #a creer - ft_lstadd_back \ #a creer - ft_lstdelone.c \ #fonction un peu changee - ft_lstdel.c \ #lstclear et un peu changee - ft_lstiter.c \ #fonction un peu changee - ft_lstmap.c \ #fonction un peu changee +SRCB = ft_lstnew.c \ + ft_lstadd.c \ + ft_lstsize \ + ft_lstlast \ + ft_lstadd_back \ + ft_lstdelone.c \ + ft_lstdel.c \ + ft_lstiter.c \ + ft_lstmap.c \ \ ft_strcat.c \ ft_strcmp.c \ diff --git a/srcs/add/ft_strnew.c b/srcs/add/ft_strnew.c index c7855ad..645feff 100644 --- a/srcs/add/ft_strnew.c +++ b/srcs/add/ft_strnew.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/11/14 21:19:08 by hulamy #+# #+# */ -/* Updated: 2019/03/25 15:25:38 by hulamy ### ########.fr */ +/* Updated: 2019/11/21 17:00:30 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/srcs/bonus/.DS_Store b/srcs/bonus/.DS_Store index c490291..697b981 100644 Binary files a/srcs/bonus/.DS_Store and b/srcs/bonus/.DS_Store differ diff --git a/srcs/bonus/a.out b/srcs/bonus/a.out index 0c2e457..3eb7c7c 100755 Binary files a/srcs/bonus/a.out and b/srcs/bonus/a.out differ diff --git a/srcs/bonus/ft_lstmap.c b/srcs/bonus/ft_lstmap.c index b3642c6..98b854e 100644 --- a/srcs/bonus/ft_lstmap.c +++ b/srcs/bonus/ft_lstmap.c @@ -115,6 +115,7 @@ t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *)) lst = lst->next; if (!(tmp->next = (t_list*)f(lst))) { + del(tmp->next->content); free(tmp->next); return (NULL); } diff --git a/srcs/part2/a.out b/srcs/part2/a.out new file mode 100755 index 0000000..fd70839 Binary files /dev/null and b/srcs/part2/a.out differ diff --git a/srcs/part2/ft_itoa.c b/srcs/part2/ft_itoa.c index 65fbfa7..5875144 100644 --- a/srcs/part2/ft_itoa.c +++ b/srcs/part2/ft_itoa.c @@ -6,11 +6,30 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/11/14 21:10:25 by hulamy #+# #+# */ -/* Updated: 2018/11/14 21:36:38 by hulamy ### ########.fr */ +/* Updated: 2019/11/25 11:57:23 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ -#include "libft.h" +/* +** take an integer and give a string +*/ + +/* +** #include +** +** char *ft_itoa(int n) +** +** int main(int ac, char **av) +** { +** if (ac == 2) +** { +** printf("%s\n",ft_itoa(atoi(av[1]))); +** } +** return 0; +** } +** +** #include "libft.h" +*/ char *ft_itoa(int n) { @@ -24,8 +43,9 @@ char *ft_itoa(int n) len++; nbis = n; nbis *= (nbis < 0) ? -1 : 1; - if (!(str = ft_strnew(len))) + if (!(str = (char *)malloc(sizeof(char) * (len + 1)))) return (NULL); + str[len] = '\0'; str[--len] = nbis % 10 + '0'; while (nbis /= 10) str[--len] = nbis % 10 + '0';