diff --git a/a.out b/a.out deleted file mode 100755 index b3544e4..0000000 Binary files a/a.out and /dev/null differ diff --git a/fff/get_next_line_utils_madumerg.c b/fff/get_next_line_utils_madumerg.c deleted file mode 100644 index 9f6d8fc..0000000 --- a/fff/get_next_line_utils_madumerg.c +++ /dev/null @@ -1,73 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* get_next_line_utils.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: adjoly +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/11/24 11:51:43 by madumerg #+# #+# */ -/* Updated: 2023/12/08 17:21:26 by adjoly ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "get_next_line.h" - -size_t ft_strlen(char *str) -{ - size_t i; - - i = 0; - while (str[i]) - i++; - return (i); -} - -char *ft_strjoin(char *s1, char *s2) -{ - size_t len; - size_t i; - size_t j; - char *str; - - if (!s2) - return (NULL); - len = ft_strlen(s1) + ft_strlen(s2); - str = malloc(sizeof(char) * (len + 1)); - if (!str) - return (NULL); - i = 0; - while (s1[i] != '\0') - { - str[i] = s1[i]; - i++; - } - j = 0; - while (s2[j] != '\0') - str[i++] = s2[j++]; - free(s1); - str[i] = '\0'; - return (str); -} - -void *ft_calloc(size_t ct, size_t size) -{ - char *str; - size_t i; - - i = 0; - if (size == 0 || ct == 0) - return (malloc(1)); - if ((int)size < 0 && (int)ct < 0) - return (NULL); - if ((unsigned long long)(size * ct) > 4294967295) - return (NULL); - str = malloc(size * ct); - if (!str) - return (NULL); - while (i < (ct * size)) - { - *(unsigned char *)(str + i) = '\0'; - i++; - } - return (str); -} diff --git a/get_next_line.c b/get_next_line.c index 4b5fa94..bd324f4 100644 --- a/get_next_line.c +++ b/get_next_line.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/01 17:11:59 by adjoly #+# #+# */ -/* Updated: 2023/12/08 18:17:17 by adjoly ### ########.fr */ +/* Updated: 2023/12/14 11:52:20 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/get_next_line.h.gch b/get_next_line.h.gch deleted file mode 100644 index e894ef3..0000000 Binary files a/get_next_line.h.gch and /dev/null differ diff --git a/get_next_line_bonus.c b/get_next_line_bonus.c index dc6235d..9d755f8 100644 --- a/get_next_line_bonus.c +++ b/get_next_line_bonus.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/01 17:11:59 by adjoly #+# #+# */ -/* Updated: 2023/12/08 18:02:13 by adjoly ### ########.fr */ +/* Updated: 2023/12/14 11:57:16 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -41,20 +41,20 @@ char *get_next_line(int fd) { static char *buf[1024]; char *res; - size_t bytes_read; + ssize_t bytes_read; res = ft_calloc(1, 1); if (!buf[fd]) buf[fd] = ft_calloc(sizeof(char), BUFFER_SIZE + 1); while (buf[fd] && res) { - res = ft_strjoin(res, buf); + res = ft_strjoin(res, buf[fd]); if (check_line(res, buf[fd])) return (res); bytes_read = read(fd, buf[fd], BUFFER_SIZE); if (bytes_read < 1) { - free(&buf[fd]); + free(buf[fd]); buf[fd] = NULL; if (res[0] != 0) return (res); diff --git a/test.txt b/test.txt deleted file mode 100644 index 5be26ed..0000000 --- a/test.txt +++ /dev/null @@ -1,8 +0,0 @@ -Si tu lis cette ligne GGWP -asdfasdf -sad -f - -sadf - -asdfasdff