# HG changeset patch # User zas_ # Date 1212478644 0 # Node ID 85253619d52225c72b6b0fe9439af79f5c870a4a # Parent e095a66b428fdfe7ec07f715a6c2a0584e271186 vflist_maint(): only allocate memory and compare strings if needed. diff -r e095a66b428f -r 85253619d522 src/view_file_list.c --- a/src/view_file_list.c Tue Jun 03 07:32:13 2008 +0000 +++ b/src/view_file_list.c Tue Jun 03 07:37:24 2008 +0000 @@ -1862,22 +1862,30 @@ void vflist_maint(ViewFile *vf, FileData *fd) { - gchar *source_base; - gchar *dest_base; - + gboolean refresh; + if (vf->refresh_idle_id != -1) return; - source_base = remove_level_from_path(fd->change->source); - dest_base = remove_level_from_path(fd->change->dest); + refresh = (strcmp(fd->path, vf->path) == 0); + + if (!refresh) + { + gchar *dest_base = remove_level_from_path(fd->change->dest); + refresh = (strcmp(dest_base, vf->path) == 0); + g_free(dest_base); + } - if (strcmp(source_base, vf->path) == 0 || - strcmp(dest_base, vf->path) == 0 || - strcmp(fd->path, vf->path) == 0) + if (!refresh) + { + gchar *source_base = remove_level_from_path(fd->change->source); + refresh = (strcmp(source_base, vf->path) == 0); + g_free(source_base); + } + + if (refresh) { vf->refresh_idle_id = g_idle_add(vflist_refresh_idle_cb, vf); } - g_free(source_base); - g_free(dest_base); } /* the plan is to drop these functions and use vflist_maint directly */