Mercurial > emacs
comparison src/dired.c @ 16246:4e00938cd261
(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'.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 19 Sep 1996 21:28:15 +0000 |
parents | ec322e4ffa16 |
children | ffdfedf6de8f |
comparison
equal
deleted
inserted
replaced
16245:d960549d163c | 16246:4e00938cd261 |
---|---|
292 struct stat st; | 292 struct stat st; |
293 int directoryp; | 293 int directoryp; |
294 int passcount; | 294 int passcount; |
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 | |
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 | 297 |
311 #ifdef VMS | 298 #ifdef VMS |
312 extern DIRENTRY * readdirver (); | 299 extern DIRENTRY * readdirver (); |
313 | 300 |
314 DIRENTRY *((* readfunc) ()); | 301 DIRENTRY *((* readfunc) ()); |
507 } | 494 } |
508 | 495 |
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) |
521 return Qt; | 502 return Qt; |
522 return Fsubstring (bestmatch, make_number (0), make_number (bestmatchsize)); | 503 return Fsubstring (bestmatch, make_number (0), make_number (bestmatchsize)); |
534 int len = NAMLEN (dp); | 515 int len = NAMLEN (dp); |
535 int pos = XSTRING (dirname)->size; | 516 int pos = XSTRING (dirname)->size; |
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])) |
542 fullname[pos++] = DIRECTORY_SEP; | 536 fullname[pos++] = DIRECTORY_SEP; |
543 #endif | 537 #endif |
551 in case it is a directory. */ | 545 in case it is a directory. */ |
552 value = lstat (fullname, st_addr); | 546 value = lstat (fullname, 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 |
561 | 561 |
562 DEFUN ("file-name-all-versions", Ffile_name_all_versions, | 562 DEFUN ("file-name-all-versions", Ffile_name_all_versions, |