emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master f769566: Use bool for boolean in xsmfns.c


From: Paul Eggert
Subject: [Emacs-diffs] master f769566: Use bool for boolean in xsmfns.c
Date: Fri, 26 Dec 2014 02:43:38 +0000

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

    Use bool for boolean in xsmfns.c
    
    * xsmfns.c, xterm.h (x_session_have_connection):
    * xsmfns.c (doing_interact, smc_interact_CB, Fhandle_save_session):
    Use bool for boolean.
    (x_session_initialize, Fhandle_save_session):
    Prefer NILP (x) to EQ (x, Qnil).
---
 src/ChangeLog |    9 +++++++++
 src/xsmfns.c  |   28 +++++++++++++---------------
 src/xterm.h   |    2 +-
 3 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index b5fb351..f3bc9fd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
+2014-12-26  Paul Eggert  <address@hidden>
+
+       Use bool for boolean in xsmfns.c
+       * xsmfns.c, xterm.h (x_session_have_connection):
+       * xsmfns.c (doing_interact, smc_interact_CB, Fhandle_save_session):
+       Use bool for boolean.
+       (x_session_initialize, Fhandle_save_session):
+       Prefer NILP (x) to EQ (x, Qnil).
+
 2014-12-23  Didier Verna  <address@hidden> (tiny change).
 
        * nsselect.m (Fns_selection_owner_p): Return a Lisp boolean, not a
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 8a835cf..a6c6985 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -53,7 +53,7 @@ static int ice_fd = -1;
 
 /* A flag that says if we are in shutdown interactions or not.  */
 
-static int doing_interact;
+static bool doing_interact;
 
 /* The session manager object for the session manager connection.  */
 
@@ -123,9 +123,9 @@ x_session_check_input (int fd, void *data)
     kbd_buffer_store_event (&emacs_event);
 }
 
-/* Return non-zero if we have a connection to a session manager.  */
+/* Return true if we have a connection to a session manager.  */
 
-int
+bool
 x_session_have_connection (void)
 {
   return ice_fd != -1;
@@ -138,7 +138,7 @@ x_session_have_connection (void)
 static void
 smc_interact_CB (SmcConn smcConn, SmPointer clientData)
 {
-  doing_interact = True;
+  doing_interact = true;
   emacs_event.kind = SAVE_SESSION_EVENT;
   emacs_event.arg = Qnil;
 }
@@ -398,15 +398,15 @@ x_session_initialize (struct x_display_info *dpyinfo)
   ptrdiff_t name_len = 0;
 
   ice_fd = -1;
-  doing_interact = False;
+  doing_interact = false;
 
   /* Check if we where started by the session manager.  If so, we will
      have a previous id.  */
-  if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id))
+  if (! NILP (Vx_session_previous_id) && STRINGP (Vx_session_previous_id))
     previous_id = SSDATA (Vx_session_previous_id);
 
   /* Construct the path to the Emacs program.  */
-  if (! EQ (Vinvocation_directory, Qnil))
+  if (! NILP (Vinvocation_directory))
     name_len += SBYTES (Vinvocation_directory);
   name_len += SBYTES (Vinvocation_name);
 
@@ -415,7 +415,7 @@ x_session_initialize (struct x_display_info *dpyinfo)
   emacs_program = xmalloc (name_len + 1);
   char *z = emacs_program;
 
-  if (! EQ (Vinvocation_directory, Qnil))
+  if (! NILP (Vinvocation_directory))
     z = lispstpcpy (z, Vinvocation_directory);
   lispstpcpy (z, Vinvocation_name);
 
@@ -489,21 +489,19 @@ is told to abort the window system shutdown.
 Do not call this function yourself. */)
   (Lisp_Object event)
 {
-  int kill_emacs = CONSP (event) && CONSP (XCDR (event))
-    && EQ (Qt, XCAR (XCDR (event)));
+  bool kill_emacs = (CONSP (event) && CONSP (XCDR (event))
+                    && EQ (Qt, XCAR (XCDR (event))));
 
   /* Check doing_interact so that we don't do anything if someone called
      this at the wrong time. */
   if (doing_interact && ! kill_emacs)
     {
-      Bool cancel_shutdown = False;
-
-      cancel_shutdown = ! EQ (call0 (intern ("emacs-session-save")), Qnil);
+      bool cancel_shutdown = ! NILP (call0 (intern ("emacs-session-save")));
 
       SmcInteractDone (smc_conn, cancel_shutdown);
       SmcSaveYourselfDone (smc_conn, True);
 
-      doing_interact = False;
+      doing_interact = false;
     }
   else if (kill_emacs)
     {
@@ -511,7 +509,7 @@ Do not call this function yourself. */)
          prevent.  Fix this in next version.  */
       Fkill_emacs (Qnil);
 
-#if 0
+#if false
       /* This will not be reached, but we want kill-emacs-hook to be run.  */
       SmcCloseConnection (smc_conn, 0, 0);
       ice_connection_closed ();
diff --git a/src/xterm.h b/src/xterm.h
index 31c3261..84bb58c 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1107,7 +1107,7 @@ extern void initialize_frame_menubar (struct frame *);
 /* Defined in xsmfns.c */
 #ifdef HAVE_X_SM
 extern void x_session_initialize (struct x_display_info *dpyinfo);
-extern int x_session_have_connection (void);
+extern bool x_session_have_connection (void);
 extern void x_session_close (void);
 #endif
 



reply via email to

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