]> git.eshelyaron.com Git - emacs.git/commitdiff
Replace some calls to `intern' with DEFSYMs
authorPo Lu <luangruo@yahoo.com>
Tue, 8 Apr 2025 02:26:18 +0000 (10:26 +0800)
committerEshel Yaron <me@eshelyaron.com>
Tue, 8 Apr 2025 05:50:24 +0000 (07:50 +0200)
* src/filelock.c (lock_file, unlock_file_handle_error): Call
constant symbols rather than interning them all the time.
(syms_of_filelock): New symbols Qask_user_about_lock,
Quserlock__handle_unlock_error, and
Quserlock__ask_user_about_supersession_threat.

(cherry picked from commit b392038560736d4413bc1b31671a9aa826ff873e)

src/filelock.c

index e61c6776e3e104ad30030779a6d5760a09c7c993..2f5744334e0291f0955f09e7948112311e419205 100644 (file)
@@ -605,7 +605,7 @@ lock_file (Lisp_Object fn)
       && NILP (Fverify_visited_file_modtime (subject_buf))
       && !NILP (Ffile_exists_p (fn))
       && !(!NILP (lfname) && current_lock_owner (NULL, lfname) == I_OWN_IT))
-    calln (intern ("userlock--ask-user-about-supersession-threat"), fn);
+    calln (Quserlock__ask_user_about_supersession_threat, fn);
 
   /* Don't do locking if the user has opted out.  */
   if (!NILP (lfname))
@@ -623,7 +623,7 @@ lock_file (Lisp_Object fn)
          memmove (dot + replacementlen, dot + 1, pidlen);
          strcpy (dot + replacementlen + pidlen, ")");
          memcpy (dot, replacement, replacementlen);
-         attack = calln (intern ("ask-user-about-lock"), fn,
+         attack = calln (Qask_user_about_lock, fn,
                          build_string (lock_info.user));
          /* Take the lock if the user said so.  */
          if (!NILP (attack))
@@ -653,7 +653,7 @@ unlock_file (Lisp_Object fn)
 static Lisp_Object
 unlock_file_handle_error (Lisp_Object err)
 {
-  calln (intern ("userlock--handle-unlock-error"), err);
+  calln (Quserlock__handle_unlock_error, err);
   return Qnil;
 }
 
@@ -827,6 +827,10 @@ Info node `(emacs)Interlocking'.  */);
   DEFSYM (Qfile_locked_p, "file-locked-p");
   DEFSYM (Qmake_lock_file_name, "make-lock-file-name");
   DEFSYM (Qstring_replace, "string-replace");
+  DEFSYM (Qask_user_about_lock, "ask-user-about-lock");
+  DEFSYM (Quserlock__handle_unlock_error, "userlock--handle-unlock-error");
+  DEFSYM (Quserlock__ask_user_about_supersession_threat,
+         "userlock--ask-user-about-supersession-threat");
 
   defsubr (&Slock_file);
   defsubr (&Sunlock_file);