summaryrefslogtreecommitdiff
path: root/src/dired.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-09-19 21:28:15 +0000
committerRichard M. Stallman <rms@gnu.org>1996-09-19 21:28:15 +0000
commitb07b09b62eae5d34883952eef4fe70950c3a62e7 (patch)
treeb2c0398cb14a28c925330d98c41d10e81b80c108 /src/dired.c
parent276c2ab39c2b60080f13c56f62decb9e192d1433 (diff)
downloademacs-b07b09b62eae5d34883952eef4fe70950c3a62e7.tar.gz
(file_name_completion): Remove code which sets and
restores the `stat' control flags (they might not be restored if C-g is pressed during completion). (file_name_completion_stat): Set and restore flags that make `stat' faster here instead of in `file_name_completion'.
Diffstat (limited to 'src/dired.c')
-rw-r--r--src/dired.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/dired.c b/src/dired.c
index a8468c0f435..1e7c9a80228 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -295,19 +295,6 @@ file_name_completion (file, dirname, all_flag, ver_flag)
int count = specpdl_ptr - specpdl;
struct gcpro gcpro1, gcpro2, gcpro3;
-#ifdef MSDOS
-#if __DJGPP__ > 1
- /* Some fields of struct stat are *very* expensive to compute on MS-DOS,
- but aren't required here. Avoid computing the following fields:
- st_inode, st_size and st_nlink for directories, and the execute bits
- in st_mode for non-directory files with non-standard extensions. */
-
- unsigned short save_djstat_flags = _djstat_flags;
-
- _djstat_flags = _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
-#endif
-#endif
-
#ifdef VMS
extern DIRENTRY * readdirver ();
@@ -509,12 +496,6 @@ file_name_completion (file, dirname, all_flag, ver_flag)
UNGCPRO;
bestmatch = unbind_to (count, bestmatch);
-#ifdef MSDOS
-#if __DJGPP__ > 1
- _djstat_flags = save_djstat_flags;
-#endif
-#endif
-
if (all_flag || NILP (bestmatch))
return bestmatch;
if (matchcount == 1 && bestmatchsize == XSTRING (file)->size)
@@ -536,6 +517,19 @@ file_name_completion_stat (dirname, dp, st_addr)
int value;
char *fullname = (char *) alloca (len + pos + 2);
+#ifdef MSDOS
+#if __DJGPP__ > 1
+ /* Some fields of struct stat are *very* expensive to compute on MS-DOS,
+ but aren't required here. Avoid computing the following fields:
+ st_inode, st_size and st_nlink for directories, and the execute bits
+ in st_mode for non-directory files with non-standard extensions. */
+
+ unsigned short save_djstat_flags = _djstat_flags;
+
+ _djstat_flags = _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
+#endif /* __DJGPP__ > 1 */
+#endif /* MSDOS */
+
bcopy (XSTRING (dirname)->data, fullname, pos);
#ifndef VMS
if (!IS_DIRECTORY_SEP (fullname[pos - 1]))
@@ -553,8 +547,14 @@ file_name_completion_stat (dirname, dp, st_addr)
stat (fullname, st_addr);
return value;
#else
- return stat (fullname, st_addr);
-#endif
+ value = stat (fullname, st_addr);
+#ifdef MSDOS
+#if __DJGPP__ > 1
+ _djstat_flags = save_djstat_flags;
+#endif /* __DJGPP__ > 1 */
+#endif /* MSDOS */
+ return value;
+#endif /* S_IFLNK */
}
#ifdef VMS