From bd4a696ab6ceb9bd00937667cc523ddd8a94a850 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Thu, 19 Apr 2012 13:23:41 +0400 Subject: [PATCH] (reread_cmd): use vfs_path_cmp() to compare dirs. Signed-off-by: Andrew Borodin --- src/filemanager/cmd.c | 16 +++------------- src/filemanager/dir.c | 3 +++ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/filemanager/cmd.c b/src/filemanager/cmd.c index 13dabb638..7b8018ea5 100644 --- a/src/filemanager/cmd.c +++ b/src/filemanager/cmd.c @@ -1038,19 +1038,9 @@ reread_cmd (void) { panel_update_flags_t flag = UP_ONLY_CURRENT; - if (get_current_type () == view_listing && get_other_type () == view_listing) - { - char *c_cwd, *o_cwd; - - c_cwd = vfs_path_to_str (current_panel->cwd_vpath); - o_cwd = vfs_path_to_str (other_panel->cwd_vpath); - - if (strcmp (c_cwd, o_cwd) == 0) - flag = UP_OPTIMIZE; - - g_free (c_cwd); - g_free (o_cwd); - } + if (get_current_type () == view_listing && get_other_type () == view_listing && + vfs_path_cmp (current_panel->cwd_vpath, other_panel->cwd_vpath) == 0) + flag = UP_OPTIMIZE; update_panels (UP_RELOAD | flag, UP_KEEPSEL); repaint_screen (); diff --git a/src/filemanager/dir.c b/src/filemanager/dir.c index 9e0b511d4..8c67093dc 100644 --- a/src/filemanager/dir.c +++ b/src/filemanager/dir.c @@ -541,6 +541,7 @@ do_load_dir (const vfs_path_t * vpath, dir_list * list, sortfn * sort, gboolean int status, link_to_dir, stale_link; int next_free = 0; struct stat st; + char *path; /* ".." (if any) must be the first entry in the list */ if (!set_zero_dir (list)) @@ -560,8 +561,10 @@ do_load_dir (const vfs_path_t * vpath, dir_list * list, sortfn * sort, gboolean tree_store_start_check (vpath); /* Do not add a ".." entry to the root directory */ + path = vfs_path_to_str (vpath); if ((path[0] == PATH_SEP) && (path[1] == '\0')) next_free--; + g_free (path); while ((dp = mc_readdir (dirp)) != NULL) { -- 2.11.4.GIT