Browse Source

1998-12-06 Federico Mena Quintero <federico@nuclecu.unam.mx>

	* dir.c (link_isdir): Fetch the information from
	file->f.link_to_dir, since we already have it.

	* dir.h (file_entry): Removed the `cache' field in this structure,
	as it was only used for the deprecated Xview version.
	Also, removed the `exists' field, as it was not being used anywhere.

	* dir.c: Removed all occurrences of file_entry->cache.

	* find.c: Removed all occurrences of file_entry->cache.

	* panelize.c: Removed all occurrences of file_entry->cache.

	* screen.c (do_enter_on_file_entry): New public function that
	implements the functionality in do_enter(), but based on a file
	entry rather than on a panel.
	(do_enter): Use do_enter_on_file_entry() with the selection of the
	panel as an argument.
Miguel de Icaza 26 years ago
parent
commit
9c2404da81
5 changed files with 20 additions and 24 deletions
  1. 13 0
      src/ChangeLog
  2. 7 20
      src/dir.c
  3. 0 2
      src/dir.h
  4. 0 1
      src/find.c
  5. 0 1
      src/panelize.c

+ 13 - 0
src/ChangeLog

@@ -1,5 +1,18 @@
 1998-12-06  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
+	* dir.c (link_isdir): Fetch the information from
+	file->f.link_to_dir, since we already have it.
+
+	* dir.h (file_entry): Removed the `cache' field in this structure,
+	as it was only used for the deprecated Xview version.
+	Also, removed the `exists' field, as it was not being used anywhere.
+
+	* dir.c: Removed all occurrences of file_entry->cache.
+
+	* find.c: Removed all occurrences of file_entry->cache.
+
+	* panelize.c: Removed all occurrences of file_entry->cache.
+
 	* screen.c (do_enter_on_file_entry): New public function that
 	implements the functionality in do_enter(), but based on a file
 	entry rather than on a panel.

+ 7 - 20
src/dir.c

@@ -296,10 +296,6 @@ void clean_dir (dir_list *list, int count)
     for (i = 0; i < count; i++){
 	free (list->list [i].fname);
 	list->list [i].fname = 0;
-	if (list->list [i].cache != NULL) {
-	    free (list->list [i].cache);
-	    list->list [i].cache = NULL;
-	}
     }
 }
 
@@ -321,7 +317,6 @@ add_dotdot_to_list (dir_list *list, int index)
 
     (list->list) [index].fnamelen = 2;
     (list->list) [index].fname = strdup ("..");
-    (list->list) [index].cache = NULL;
     (list->list) [index].f.link_to_dir = 0;
     (list->list) [index].f.stalled_link = 0;
     
@@ -475,7 +470,6 @@ int do_load_dir(dir_list *list, sortfn *sort, int reverse, int case_sensitive, c
 	    return next_free;
 	list->list [next_free].fnamelen = NLENGTH (dp);
 	list->list [next_free].fname = strdup (dp->d_name);
-	list->list [next_free].cache = NULL; 
 	list->list [next_free].f.marked = 0;
 	list->list [next_free].f.link_to_dir = link_to_dir;
 	list->list [next_free].f.stalled_link = stalled_link;
@@ -503,13 +497,11 @@ int do_load_dir(dir_list *list, sortfn *sort, int reverse, int case_sensitive, c
 int link_isdir (file_entry *file)
 {
     struct stat b;
-    
-    if (S_ISLNK (file->buf.st_mode)){
-	mc_stat (file->fname, &b);
-	if (S_ISDIR (b.st_mode))
-	    return 1;
-    }
-    return 0;
+
+    if (file->f.link_to_dir)
+	return 1;
+    else
+	return 0;
 }
  
 int if_link_is_exe (file_entry *file)
@@ -535,18 +527,15 @@ static void alloc_dir_copy (int size)
 	    for (i = 0; i < dir_copy.size; i++) {
 		if (dir_copy.list [i].fname)
 		    free (dir_copy.list [i].fname);
-		if (dir_copy.list [i].cache)
-		    free (dir_copy.list [i].cache);
 	    }
 	    free (dir_copy.list);
 	    dir_copy.list = 0;
 	}
 
 	dir_copy.list = xmalloc (sizeof (file_entry) * size, "alloc_dir_copy");
-	for (i = 0; i < size; i++) {
+	for (i = 0; i < size; i++)
 	    dir_copy.list [i].fname = 0;
-	    dir_copy.list [i].cache = NULL;
-	}
+
 	dir_copy.size = size;
     }
 }
@@ -574,7 +563,6 @@ int do_reload_dir (dir_list *list, sortfn *sort, int count, int rev,
     for (i = 0; i < count; i++){
 	dir_copy.list [i].fnamelen = list->list [i].fnamelen;
 	dir_copy.list [i].fname =    list->list [i].fname;
-	dir_copy.list [i].cache =    list->list [i].cache;
 	dir_copy.list [i].f.marked = list->list [i].f.marked;
 	dir_copy.list [i].f.link_to_dir = list->list [i].f.link_to_dir;
 	dir_copy.list [i].f.stalled_link = list->list [i].f.stalled_link;
@@ -614,7 +602,6 @@ int do_reload_dir (dir_list *list, sortfn *sort, int count, int rev,
 	
 	list->list [next_free].fnamelen = tmp_len;
 	list->list [next_free].fname = strdup (dp->d_name);
-	list->list [next_free].cache = NULL;
 	list->list [next_free].f.link_to_dir = link_to_dir;
 	list->list [next_free].f.stalled_link = stalled_link;
 	list->list [next_free].buf = buf;

+ 0 - 2
src/dir.h

@@ -15,11 +15,9 @@ typedef struct {
     /* Flags */
     struct { 
 	unsigned int marked:1;		/* File marked in pane window */
-	unsigned int exists:1;		/* Use for rereading file */
 	unsigned int link_to_dir:1;	/* If this is a link, does it point to directory? */
 	unsigned int stalled_link:1;    /* If this is a symlink and points to Charon's land */
     } f;
-    char *cache;
 } file_entry;
 
 typedef struct {

+ 0 - 1
src/find.c

@@ -858,7 +858,6 @@ find_file (char *start_dir, char *pattern, char *content, char **dirname,  char
     		clean_dir (list, cpanel->count);
 	    list->list [next_free].fnamelen = strlen (name);
 	    list->list [next_free].fname = name;
-	    list->list [next_free].cache = NULL;
 	    file_mark (cpanel, next_free, 0);
 	    list->list [next_free].f.link_to_dir = link_to_dir;
 	    list->list [next_free].f.stalled_link = stalled_link;

+ 0 - 1
src/panelize.c

@@ -439,7 +439,6 @@ void do_external_panelize (char *command)
 	    break;
 	list->list [next_free].fnamelen = strlen (name);
 	list->list [next_free].fname = strdup (name);
-	list->list [next_free].cache = NULL;
 	file_mark (cpanel, next_free, 0);
 	list->list [next_free].f.link_to_dir = link_to_dir;
 	list->list [next_free].f.stalled_link = stalled_link;