summaryrefslogtreecommitdiff
path: root/src/dired.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2012-12-14 16:05:01 +0200
committerEli Zaretskii <eliz@gnu.org>2012-12-14 16:05:01 +0200
commit5c207910c4899af1c547b0e508692d846c145d48 (patch)
treeb3516d3332d126e8add66cfff68c11ac7ed187b8 /src/dired.c
parentb421decc52e07a3c56b2b259321867bc352f5173 (diff)
downloademacs-5c207910c4899af1c547b0e508692d846c145d48.tar.gz
emacs-5c207910c4899af1c547b0e508692d846c145d48.tar.bz2
emacs-5c207910c4899af1c547b0e508692d846c145d48.zip
Speed up most calls to 'stat' and 'lstat' on MS-Windows.
src/w32.c (stat_worker): If w32_stat_get_owner_group is zero, do not try to get accurate owner and group information from NT file security APIs. This is to make most callers of 'stat' and 'lstat', which don't need that information, much faster. src/dired.c (Ffile_attributes) [WINDOWSNT]: Set w32_stat_get_owner_group to a non-zero value, to request accurate owner and group information from 'lstat'. nt/inc/sys/stat.h: Declare w32_stat_get_owner_group.
Diffstat (limited to 'src/dired.c')
-rw-r--r--src/dired.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/dired.c b/src/dired.c
index bdb71c46364..85af906c1da 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -895,6 +895,7 @@ so last access time will always be midnight of that day. */)
Lisp_Object dirname;
struct stat sdir;
#endif /* BSD4_2 */
+ int lstat_result;
/* An array to hold the mode string generated by filemodestring,
including its terminating space and null byte. */
@@ -922,7 +923,21 @@ so last access time will always be midnight of that day. */)
encoded = ENCODE_FILE (filename);
UNGCPRO;
- if (lstat (SSDATA (encoded), &s) < 0)
+#ifdef WINDOWSNT
+ /* We usually don't request accurate owner and group info, because
+ it can be very expensive on Windows to get that, and most callers
+ of 'lstat' don't need that. But here we do want that information
+ to be accurate. */
+ w32_stat_get_owner_group = 1;
+#endif
+
+ lstat_result = lstat (SSDATA (encoded), &s);
+
+#ifdef WINDOWSNT
+ w32_stat_get_owner_group = 0;
+#endif
+
+ if (lstat_result < 0)
return Qnil;
values[0] = (S_ISLNK (s.st_mode) ? Ffile_symlink_p (filename)