summaryrefslogtreecommitdiff
path: root/src/filelock.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-03-25 13:37:23 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2020-03-25 13:40:34 -0700
commit2ea87d6c6f1161801402958bdc6b6a2e6c41c6b8 (patch)
treeb225e1669bc7bfd9380389dc4422216d6c0efd31 /src/filelock.c
parent11b37a4167d2eee4cb1f467a7f8ebaa6c8667ce9 (diff)
downloademacs-2ea87d6c6f1161801402958bdc6b6a2e6c41c6b8.tar.gz
Pacify --enable-gcc-warnings for lock_file
* src/filelock.c (lock_file): Pacify gcc -Wmaybe-uninitialized after recent change to this function.
Diffstat (limited to 'src/filelock.c')
-rw-r--r--src/filelock.c24
1 files 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);