aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1996-09-19 21:28:15 +0000
committerRichard M. Stallman1996-09-19 21:28:15 +0000
commit04924ee3f480147b84cb3485a5cdd919725d59dd (patch)
treedeafbe193ff975dea3e741f4535dae2a8a9e673e /src
parentb4222ffacb5e8e101353c09ebba97022a8fdec1b (diff)
downloademacs-04924ee3f480147b84cb3485a5cdd919725d59dd.tar.gz
emacs-04924ee3f480147b84cb3485a5cdd919725d59dd.zip
(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')
-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)
295 int count = specpdl_ptr - specpdl; 295 int count = specpdl_ptr - specpdl;
296 struct gcpro gcpro1, gcpro2, gcpro3; 296 struct gcpro gcpro1, gcpro2, gcpro3;
297 297
298#ifdef MSDOS
299#if __DJGPP__ > 1
300 /* Some fields of struct stat are *very* expensive to compute on MS-DOS,
301 but aren't required here. Avoid computing the following fields:
302 st_inode, st_size and st_nlink for directories, and the execute bits
303 in st_mode for non-directory files with non-standard extensions. */
304
305 unsigned short save_djstat_flags = _djstat_flags;
306
307 _djstat_flags = _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
308#endif
309#endif
310
311#ifdef VMS 298#ifdef VMS
312 extern DIRENTRY * readdirver (); 299 extern DIRENTRY * readdirver ();
313 300
@@ -509,12 +496,6 @@ file_name_completion (file, dirname, all_flag, ver_flag)
509 UNGCPRO; 496 UNGCPRO;
510 bestmatch = unbind_to (count, bestmatch); 497 bestmatch = unbind_to (count, bestmatch);
511 498
512#ifdef MSDOS
513#if __DJGPP__ > 1
514 _djstat_flags = save_djstat_flags;
515#endif
516#endif
517
518 if (all_flag || NILP (bestmatch)) 499 if (all_flag || NILP (bestmatch))
519 return bestmatch; 500 return bestmatch;
520 if (matchcount == 1 && bestmatchsize == XSTRING (file)->size) 501 if (matchcount == 1 && bestmatchsize == XSTRING (file)->size)
@@ -536,6 +517,19 @@ file_name_completion_stat (dirname, dp, st_addr)
536 int value; 517 int value;
537 char *fullname = (char *) alloca (len + pos + 2); 518 char *fullname = (char *) alloca (len + pos + 2);
538 519
520#ifdef MSDOS
521#if __DJGPP__ > 1
522 /* Some fields of struct stat are *very* expensive to compute on MS-DOS,
523 but aren't required here. Avoid computing the following fields:
524 st_inode, st_size and st_nlink for directories, and the execute bits
525 in st_mode for non-directory files with non-standard extensions. */
526
527 unsigned short save_djstat_flags = _djstat_flags;
528
529 _djstat_flags = _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
530#endif /* __DJGPP__ > 1 */
531#endif /* MSDOS */
532
539 bcopy (XSTRING (dirname)->data, fullname, pos); 533 bcopy (XSTRING (dirname)->data, fullname, pos);
540#ifndef VMS 534#ifndef VMS
541 if (!IS_DIRECTORY_SEP (fullname[pos - 1])) 535 if (!IS_DIRECTORY_SEP (fullname[pos - 1]))
@@ -553,8 +547,14 @@ file_name_completion_stat (dirname, dp, st_addr)
553 stat (fullname, st_addr); 547 stat (fullname, st_addr);
554 return value; 548 return value;
555#else 549#else
556 return stat (fullname, st_addr); 550 value = stat (fullname, st_addr);
557#endif 551#ifdef MSDOS
552#if __DJGPP__ > 1
553 _djstat_flags = save_djstat_flags;
554#endif /* __DJGPP__ > 1 */
555#endif /* MSDOS */
556 return value;
557#endif /* S_IFLNK */
558} 558}
559 559
560#ifdef VMS 560#ifdef VMS