summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-08-11 01:04:30 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-08-11 01:07:31 -0700
commita56e6e79613779895975b1762c311bf8fe46f551 (patch)
treea5b61d84922996945ab52f2944b4d7538a626db0 /lisp/files.el
parent179499cde921a28c82400b1674520da245b93bb9 (diff)
downloademacs-a56e6e79613779895975b1762c311bf8fe46f551.tar.gz
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.
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el10
1 files changed, 0 insertions, 10 deletions
diff --git a/lisp/files.el b/lisp/files.el
index f2758ab18ca..0fe7f9c522a 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -792,16 +792,6 @@ The path separator is colon in GNU and GNU-like systems."
(lambda (f) (and (file-directory-p f) 'dir-ok)))
(error "No such directory found via CDPATH environment variable"))))
-(defsubst directory-name-p (name)
- "Return non-nil if NAME ends with a directory separator character."
- (let ((len (length name))
- (lastc ?.))
- (if (> len 0)
- (setq lastc (aref name (1- len))))
- (or (= lastc ?/)
- (and (memq system-type '(windows-nt ms-dos))
- (= lastc ?\\)))))
-
(defun directory-files-recursively (dir regexp &optional include-directories)
"Return list of all files under DIR that have file names matching REGEXP.
This function works recursively. Files are returned in \"depth first\"