emacs-diffs
[Top][All Lists]
Advanced

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

master 2ea87d6 1/2: Pacify --enable-gcc-warnings for lock_file


From: Paul Eggert
Subject: master 2ea87d6 1/2: Pacify --enable-gcc-warnings for lock_file
Date: Wed, 25 Mar 2020 16:40:41 -0400 (EDT)

branch: master
commit 2ea87d6c6f1161801402958bdc6b6a2e6c41c6b8
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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 2b734ee..ee46e0e 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);



reply via email to

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