aboutsummaryrefslogtreecommitdiffstats
path: root/libft
diff options
context:
space:
mode:
Diffstat (limited to 'libft')
-rw-r--r--libft/src/get_next_line.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libft/src/get_next_line.c b/libft/src/get_next_line.c
index 64ca7fc..4ace77a 100644
--- a/libft/src/get_next_line.c
+++ b/libft/src/get_next_line.c
@@ -21,7 +21,7 @@ static uint8_t
size_t i;
i = 0;
- while (str && str[i])
+ while (str[i] != '\0')
{
if (str[i] == '\n')
return (1);
@@ -56,12 +56,12 @@ static int
buff[ret] = '\0';
tmp = *str;
*str = ft_strjoin(tmp, buff);
- free(tmp);
+ ft_memdel((void**)&tmp);
}
if (ret < 0)
{
- free(*str);
- free(buff);
+ ft_memdel((void**)&str);
+ ft_memdel((void**)&buff);
return (-1);
}
free(buff);
@@ -75,7 +75,7 @@ static int
*str = ft_nstr(0);
if (fd < 0 || !line || BUFFER_SIZE <= 0)
{
- free(*str);
+ ft_memdel((void**)&str);
return (-1);
}
return (0);
@@ -102,10 +102,10 @@ int
if (ret == 0 && ((str == NULL || str[0] == '\0') || !ft_linecheck(str)))
{
i = tmp[i];
- free(tmp);
- tmp = NULL;
+ if (i == '\n')
+ ft_memdel((void**)&tmp);
return (i == '\n');
}
- free(tmp);
+ ft_memdel((void**)&tmp);
return (1);
}