emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f0319cd86f: Make file-parent-directory more efficient


From: Lars Ingebrigtsen
Subject: master f0319cd86f: Make file-parent-directory more efficient
Date: Thu, 1 Sep 2022 06:08:53 -0400 (EDT)

branch: master
commit f0319cd86f8d147e443bcaa0927937ccf052fbd0
Author: Daanturo <daanturo@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make file-parent-directory more efficient
    
    * lisp/files.el (file-parent-directory): Use equal instead of
    file-equal-p to compare the found parent and the child
    (bug#56355).  This is much faster.
---
 lisp/files.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/files.el b/lisp/files.el
index 740e09055b..b084dca8b7 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5196,7 +5196,9 @@ to `default-directory', and the result will also be 
relative."
     (cond
      ;; filename is at top-level, therefore no parent
      ((or (null parent)
-          (file-equal-p parent expanded-filename))
+          ;; `equal' is enough, we don't need to resolve symlinks here
+          ;; with `file-equal-p', also for performance
+          (equal parent expanded-filename))
       nil)
      ;; filename is relative, return relative parent
      ((not (file-name-absolute-p filename))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]