Avoid most stat calls when completing file names
commit3a8d0cc825635e07da2a90c4ac987b476fc9b05d
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 31 Jul 2017 19:31:02 +0000 (31 12:31 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 31 Jul 2017 19:56:51 +0000 (31 12:56 -0700)
tree7a18ef1a777007f05feff6a35ebadc4338330906
parent192342a3a93a2e467ab589ae2d1ffd5e7acf1398
Avoid most stat calls when completing file names

* admin/merge-gnulib (GNULIB_MODULES): Add d-type.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* m4/d-type.m4: New file, copied from gnulib.
* src/dired.c (DT_UNKNOWN, DT_DIR, DT_LINK)
[!HAVE_STRUCT_DIRENT_D_TYPE]: New constants.
(dirent_type): New function.
(file_name_completion): Use it, to avoid unnecessary calls to
stat-like functions on GNU/Linux and other platforms with d_type.
(file_name_completion_stat): Just follow the link; there is no
need to try first with AT_SYMLINK_NOFOLLOW since the directory
entry was already checked to exist.
admin/merge-gnulib
lib/gnulib.mk.in
m4/d-type.m4 [new file with mode: 0644]
m4/gnulib-comp.m4
src/dired.c