diff --git a/src/ChangeLog b/src/ChangeLog index d89f0687c..2832549aa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2002-01-20 Pavel Roskin + * dir.c (add_dotdot_to_list): Don't use costly stat() - just put + realistic (i.e. bogus) data to the list. + * screen.c (string_file_size): Don't display size of ".." - it may take too much time to calculate it on VFS. Show "UP--DIR" instead. diff --git a/src/dir.c b/src/dir.c index fa11cdbe4..8abaca6f2 100644 --- a/src/dir.c +++ b/src/dir.c @@ -342,10 +342,6 @@ clean_dir (dir_list *list, int count) static int add_dotdot_to_list (dir_list *list, int index) { - char buffer [MC_MAXPATHLEN + MC_MAXPATHLEN]; - char *p; - int i = 0; - /* Need to grow the *list? */ if (index == list->size) { list->list = g_realloc (list->list, sizeof (file_entry) * @@ -355,40 +351,14 @@ add_dotdot_to_list (dir_list *list, int index) list->size += RESIZE_STEPS; } + memset (&(list->list) [index], 0, sizeof(file_entry)); (list->list) [index].fnamelen = 2; (list->list) [index].fname = g_strdup (".."); (list->list) [index].f.link_to_dir = 0; (list->list) [index].f.stalled_link = 0; (list->list) [index].f.dir_size_computed = 0; - - /* FIXME: We need to get the panel definition! to use file_mark */ (list->list) [index].f.marked = 0; - mc_get_current_wd (buffer, sizeof (buffer) - 1 ); - if (buffer [strlen (buffer) - 1] == PATH_SEP) - buffer [strlen (buffer) - 1] = 0; - for (;;) { - strcat (buffer, PATH_SEP_STR ".."); - p = vfs_canon (buffer); - if (mc_stat (p, &((list->list) [index].buf)) != -1){ - g_free (p); - break; - } - i = 1; - if (!strcmp (p, PATH_SEP_STR)){ - g_free (p); - return 1; - } - strcpy (buffer, p); - g_free (p); - } - -/* Commented out to preserve a usable '..'. What's the purpose of this - * three lines? (Norbert) */ -#if 0 - if (i) { /* So there is bogus information on the .. directory's stat */ - (list->list) [index].buf.st_mode &= ~0444; - } -#endif + (list->list) [index].buf.st_mode = 040755; return 1; }