diff options
Diffstat (limited to '')
-rw-r--r-- | libft/src/get_next_line.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/libft/src/get_next_line.c b/libft/src/get_next_line.c index 2b2ba80..032ad95 100644 --- a/libft/src/get_next_line.c +++ b/libft/src/get_next_line.c @@ -16,8 +16,7 @@ #include <stdint.h> #include <unistd.h> -static char - *ft_strjoin_gnl(char *s1, char *s2) +static char *ft_strjoin_gnl(char *s1, char *s2) { size_t i; size_t j; @@ -40,14 +39,13 @@ static char return (dst); } -static int - ft_read_gnl(int fd, char **line, t_gnl *curr) +static int ft_read_gnl(int fd, char **line, t_gnl *curr) { char *buf; char *end; int64_t size; - if (!(buf = malloc(BUFFER_SIZE + 1))) + if ((buf = malloc(BUFFER_SIZE + 1)) == NULL) return (-1); *buf = 0; *line = ft_strjoin_gnl(*line, curr->rest); @@ -70,8 +68,7 @@ static int return (size); } -int - get_next_line(int fd, char **line) +int get_next_line(int fd, char **line) { static t_gnl *list; t_gnl *curr; @@ -80,7 +77,7 @@ int if (fd < 0 || BUFFER_SIZE <= 0) return (-1); - if (!(*line = (char *)malloc(1 * sizeof(char)))) + if ((*line = (char *)malloc(1 * sizeof(char))) == NULL) return (-1); **line = 0; curr = ft_find_fd(fd, &list); |