Improve performance for rename-file etc.
commita56e6e79613779895975b1762c311bf8fe46f551
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 11 Aug 2017 08:04:30 +0000 (11 01:04 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 11 Aug 2017 08:07:31 +0000 (11 01:07 -0700)
treea5b61d84922996945ab52f2944b4d7538a626db0
parent179499cde921a28c82400b1674520da245b93bb9
Improve performance for rename-file etc.

Although this does not fix Bug#27986, it is a step forward.
I plan to propose a more-significant patch later.
* lisp/files.el (directory-name-p): Move from here ...
* src/fileio.c (Fdirectory_name_p): ... to here.
(directory_like, cp_like_target): New static functions.
(Fcopy_file, Frename_file, Fadd_name_to_file)
(Fmake_symbolic_link):
Use them, to avoid directory-testing syscalls on file names that
must be directories if they exist.  Omit unnecessary
initializations and CHECK_STRING calls.
(Frename_file): Don't call file_name_case_insensitive_p
twice on the same file.  Compare both file names expanded, instead
of the old name expanded and the new one unexpanded.
lisp/files.el
src/fileio.c