Fix rematching and one leak
This commit is contained in:
parent
2abdf8c925
commit
b15e89e4fc
4 changed files with 14 additions and 11 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/09 13:30:57 by alao #+# #+# */
|
||||
/* Updated: 2017/02/16 12:02:41 by alao ### ########.fr */
|
||||
/* Updated: 2017/02/16 15:18:14 by alao ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/10/15 13:27:14 by alao #+# #+# */
|
||||
/* Updated: 2017/02/15 19:06:32 by alao ### ########.fr */
|
||||
/* Updated: 2017/02/16 15:16:05 by alao ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -32,6 +32,9 @@ int c_matching(t_data *s, t_comp *c)
|
|||
else
|
||||
c_seek_files(s, c);
|
||||
if (c->lst)
|
||||
{
|
||||
c_sizing(c);
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/03 13:10:38 by alao #+# #+# */
|
||||
/* Updated: 2017/02/16 12:10:24 by alao ### ########.fr */
|
||||
/* Updated: 2017/02/16 15:16:10 by alao ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -34,6 +34,7 @@ int c_updater(t_comp *c, char *select)
|
|||
tmp = ft_strdup(c->rcmd);
|
||||
rt = ft_strjoin(tmp, select);
|
||||
tmp ? ft_memdel((void *)&tmp) : (0);
|
||||
data_singleton()->line.input ? ft_memdel((void *)&data_singleton()->line.input) : (0);
|
||||
if (c->trail)
|
||||
data_singleton()->line.input = ft_strjoin(rt, c->trail);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/15 12:03:30 by alao #+# #+# */
|
||||
/* Updated: 2017/02/16 12:15:28 by alao ### ########.fr */
|
||||
/* Updated: 2017/02/16 15:17:52 by alao ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -21,13 +21,16 @@ static int c_refresh_match(t_comp *c, long int keypress)
|
|||
char *tmp;
|
||||
char kpconv[2];
|
||||
|
||||
kpconv[0] = keypress;
|
||||
kpconv[0] = (char)keypress;
|
||||
kpconv[1] = '\0';
|
||||
tmp = c->match ? ft_strjoin(c->match, kpconv) : ft_strdup(kpconv);
|
||||
c->match ? ft_memdel((void *)&c->match) : (0);
|
||||
c->match = ft_strdup(tmp);
|
||||
tmp ? ft_memdel((void *)&tmp) : (0);
|
||||
(void)c;
|
||||
tmp = ft_strjoin(c->rcmd, kpconv);
|
||||
c->rcmd ? ft_memdel((void *)&c->rcmd) : (0);
|
||||
c->rcmd = ft_strdup(tmp);
|
||||
tmp ? ft_memdel((void *)&tmp) : (0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
@ -50,12 +53,8 @@ int c_rematch(t_comp *c, long int keypress)
|
|||
c_refresh_match(c, keypress);
|
||||
c_clear_lst(c);
|
||||
c->lst = NULL;
|
||||
c_seek_files(data_singleton(), c);
|
||||
if (c->lst)
|
||||
{
|
||||
c_sizing(c);
|
||||
if (c_matching(data_singleton(), c))
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue