(set_panel_filter_to): rename variable and use MC_PTR_FREE macro.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2017-05-03 14:55:57 +03:00
parent 8bf7e69134
commit a4518eed9e

View File

@ -172,18 +172,15 @@ do_edit (const vfs_path_t * what_vpath)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static void static void
set_panel_filter_to (WPanel * p, char *allocated_filter_string) set_panel_filter_to (WPanel * p, char *filter)
{ {
g_free (p->filter); MC_PTR_FREE (p->filter);
p->filter = NULL;
/* Three ways to clear filter: NULL, "", "*" */ /* Three ways to clear filter: NULL, "", "*" */
if (allocated_filter_string == NULL || if (filter == NULL || filter[0] == '\0' || (filter[0] == '*' && filter[1] == '\0'))
allocated_filter_string[0] == '\0' || g_free (filter);
(allocated_filter_string[0] == '*' && allocated_filter_string[1] == '\0'))
g_free (allocated_filter_string);
else else
p->filter = allocated_filter_string; p->filter = filter;
reread_cmd (); reread_cmd ();
} }