pbm sanitize resolved
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
i = 0;
|
||||
}
|
||||
free (fd);
|
||||
while (1);
|
||||
//while (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -110,23 +110,16 @@ int hasnewline(char *str, t_gnlist *lst, char **line)
|
||||
return (1);
|
||||
}
|
||||
|
||||
//void free_lst(t_gnlist **lst, const int fd)
|
||||
void free_lst(t_gnlist **lst)
|
||||
void free_lst(t_gnlist **lst, const int fd)
|
||||
{
|
||||
t_gnlist *tmp;
|
||||
|
||||
tmp = (*lst)->next->next;
|
||||
(*lst)->lfd = (*lst)->next->lfd;
|
||||
free((*lst)->string);
|
||||
(*lst)->string = (*lst)->next->string;
|
||||
free((*lst)->next);
|
||||
(*lst)->next = tmp;
|
||||
// tmp = *lst;
|
||||
// while ((*lst)->next && (*lst)->next->lfd != fd)
|
||||
// (*lst) = (*lst)->next;
|
||||
// free(tmp->string);
|
||||
// free(tmp);
|
||||
// (*lst)->next = (*lst)->next->next;
|
||||
tmp = *lst;
|
||||
while ((*lst)->next && (*lst)->next->lfd != fd)
|
||||
(*lst) = (*lst)->next;
|
||||
free(tmp->string);
|
||||
(*lst)->next = (*lst)->next->next;
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
int get_next_line(const int fd, char **line)
|
||||
@@ -153,7 +146,6 @@ int get_next_line(const int fd, char **line)
|
||||
return (-1);
|
||||
if (*(lst->string) && ++ret == 1)
|
||||
(lst->string)[0] = '\0';
|
||||
//free_lst(&lst, fd);
|
||||
//free_lst(&lst);
|
||||
free_lst(&lst, fd);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@@ -28,8 +28,7 @@ int get_next_line(const int fd, char **line);
|
||||
int multi_fd(int fd, t_gnlist **lst);
|
||||
char *ft_strjoinfree(char const *s1, char const *s2);
|
||||
int hasnewline(char *str, t_gnlist *lst, char **line);
|
||||
//void free_lst(t_gnlist **lst, const int fd);
|
||||
void free_lst(t_gnlist **lst);
|
||||
void free_lst(t_gnlist **lst, const int fd);
|
||||
|
||||
size_t ft_strlen(const char *str);
|
||||
void *ft_memmove(void *dst, const void *src, size_t len);
|
||||
|
||||
Reference in New Issue
Block a user