diff --git a/42sh/src/line_editing/ft_prompt.c b/42sh/src/line_editing/ft_prompt.c index 4fc017fd..8de676fc 100644 --- a/42sh/src/line_editing/ft_prompt.c +++ b/42sh/src/line_editing/ft_prompt.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 13:51:33 by gwojda #+# #+# */ -/* Updated: 2017/03/18 14:23:53 by gwojda ### ########.fr */ +/* Updated: 2017/03/19 18:02:08 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -24,18 +24,18 @@ static int promt_git_status(int fd) line = ft_strdup(ft_strrchr(line, '/') + 1); else line = ft_strdup(line + 3); - free(tmp); + ft_strdel(&tmp); ft_printf("\x1b[38;5;47mgit:(\x1b[38;5;203m%s\x1b[38;5;47m)", line); if (!get_next_line(fd, &tmp)) ft_printf("\x1b[38;5;83m ✓ "); else { ft_printf("\x1b[38;5;1m ✗ "); - free(tmp); + ft_strdel(&tmp); } - while (get_next_line(fd, &tmp)) - free(tmp); - free(tmp); + while (get_next_line(fd, &tmp) > 0) + ft_strdel(&tmp); + ft_strdel(&tmp); len = ft_strlen(line); ft_strdel(&line); return (len + 8);