From 2ea87d6c6f1161801402958bdc6b6a2e6c41c6b8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 25 Mar 2020 13:37:23 -0700 Subject: [PATCH] Pacify --enable-gcc-warnings for lock_file * src/filelock.c (lock_file): Pacify gcc -Wmaybe-uninitialized after recent change to this function. --- src/filelock.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/filelock.c b/src/filelock.c index 2b734ee00d5..ee46e0e3e00 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -661,7 +661,7 @@ void lock_file (Lisp_Object fn) { Lisp_Object orig_fn, encoded_fn; - char *lfname; + char *lfname = NULL; lock_info_type lock_info; USE_SAFE_ALLOCA; @@ -686,21 +686,15 @@ lock_file (Lisp_Object fn) /* See if this file is visited and has changed on disk since it was visited. */ - { - register Lisp_Object subject_buf; - - subject_buf = get_truename_buffer (orig_fn); - - if (!NILP (subject_buf) - && NILP (Fverify_visited_file_modtime (subject_buf)) - && !NILP (Ffile_exists_p (fn)) - && (!create_lockfiles || current_lock_owner (NULL, lfname) != -2)) - call1 (intern ("userlock--ask-user-about-supersession-threat"), fn); - - } + Lisp_Object subject_buf = get_truename_buffer (orig_fn); + if (!NILP (subject_buf) + && NILP (Fverify_visited_file_modtime (subject_buf)) + && !NILP (Ffile_exists_p (fn)) + && !(lfname && current_lock_owner (NULL, lfname) == -2)) + call1 (intern ("userlock--ask-user-about-supersession-threat"), fn); /* Don't do locking if the user has opted out. */ - if (create_lockfiles) + if (lfname) { /* Try to lock the lock. FIXME: This ignores errors when lock_if_free returns a positive errno value. */ @@ -860,7 +854,7 @@ syms_of_filelock (void) The name of the (per-buffer) lockfile is constructed by prepending a '.#' to the name of the file being locked. See also `lock-buffer' and Info node `(emacs)Interlocking'. */); - create_lockfiles = 1; + create_lockfiles = true; defsubr (&Sunlock_buffer); defsubr (&Slock_buffer); -- 2.39.2