summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1996-07-07 22:37:17 +0000
committerKarl Heuer <kwzh@gnu.org>1996-07-07 22:37:17 +0000
commit152726a88106b5d2d0ae489872d8eb80e3a8c9a4 (patch)
treee8aed55fa3ad2eccb4ec8726484edecbf390dd7f /src
parent795e0b1c8f3361e1ec451981b7507accd092efc2 (diff)
downloademacs-152726a88106b5d2d0ae489872d8eb80e3a8c9a4.tar.gz
(file_name_completion): Set `stat' flags to avoid
computing expensive fields in struct stat (makes filename completion much faster).
Diffstat (limited to 'src')
-rw-r--r--src/dired.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/dired.c b/src/dired.c
index 29027718da4..9767f6289c1 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -295,6 +295,19 @@ 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 ();
@@ -496,6 +509,12 @@ 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)