ecriture en cours de free lst
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/12/11 00:27:09 by hulamy #+# #+# */
|
/* Created: 2019/12/11 00:27:09 by hulamy #+# #+# */
|
||||||
/* Updated: 2019/12/12 23:01:04 by hulamy ### ########.fr */
|
/* Updated: 2019/12/15 19:00:37 by hulamy ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -114,6 +114,17 @@ int hasnewline(char *str, t_gnlist *lst, char **line)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void free_lst(t_gnlist **lst, const int fd)
|
||||||
|
{
|
||||||
|
t_gnlist *tmp;
|
||||||
|
|
||||||
|
tmp = *lst;
|
||||||
|
while ((*lst)->next && (*lst)->next->lfd != fd)
|
||||||
|
(*lst) = (*lst)->next;
|
||||||
|
free(tmp);
|
||||||
|
(*lst)->next = (*lst)->next->next;
|
||||||
|
}
|
||||||
|
|
||||||
int get_next_line(const int fd, char **line)
|
int get_next_line(const int fd, char **line)
|
||||||
{
|
{
|
||||||
char buf[BUFF_SIZE + 1];
|
char buf[BUFF_SIZE + 1];
|
||||||
@@ -143,5 +154,10 @@ int get_next_line(const int fd, char **line)
|
|||||||
// lst = lst->next;
|
// lst = lst->next;
|
||||||
// lst->next = lst->next->next;
|
// lst->next = lst->next->next;
|
||||||
// free(lst->next);
|
// free(lst->next);
|
||||||
|
|
||||||
|
// while (lst->next && lst->next->lfd != fd)
|
||||||
|
// lst = lst->next;
|
||||||
|
// free(lst->next);
|
||||||
|
// lst->next = lst->next->next;
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user