From b392038560736d4413bc1b31671a9aa826ff873e Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 8 Apr 2025 10:26:18 +0800 Subject: [PATCH] Replace some calls to `intern' with DEFSYMs * 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. --- src/filelock.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/filelock.c b/src/filelock.c index e61c6776e3e..2f5744334e0 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -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);