diff src/process.c @ 39973:579177964efa

Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting with lisp system changes.
author Ken Raeburn <raeburn@raeburn.org>
date Tue, 16 Oct 2001 09:09:51 +0000
parents 4ca5cbe5610d
children 6b389fb978bc
line wrap: on
line diff
--- a/src/process.c	Mon Oct 15 20:52:59 2001 +0000
+++ b/src/process.c	Tue Oct 16 09:09:51 2001 +0000
@@ -2367,7 +2367,9 @@
   int wait_channel = -1;
   struct Lisp_Process *wait_proc = 0;
   int got_some_input = 0;
-  Lisp_Object *wait_for_cell = 0;
+  /* Either nil or a cons cell, the car of which is of interest and
+     may be changed outside of this routine.  */
+  Lisp_Object wait_for_cell = Qnil;
 
   FD_ZERO (&Available);
 
@@ -2383,7 +2385,7 @@
   /* If waiting for non-nil in a cell, record where.  */
   if (CONSP (read_kbd))
     {
-      wait_for_cell = &XCAR (read_kbd);
+      wait_for_cell = read_kbd;
       XSETFASTINT (read_kbd, 0);
     }
 
@@ -2417,7 +2419,7 @@
 	QUIT;
 
       /* Exit now if the cell we're waiting for became non-nil.  */
-      if (wait_for_cell && ! NILP (*wait_for_cell))
+      if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
 	break;
 
       /* Compute time from now till when time limit is up */
@@ -2446,7 +2448,7 @@
 	 But not if wait_for_cell; in those cases,
 	 the wait is supposed to be short,
 	 and those callers cannot handle running arbitrary Lisp code here.  */
-      if (! wait_for_cell)
+      if (NILP (wait_for_cell))
 	{
 	  EMACS_TIME timer_delay;
 
@@ -2567,7 +2569,7 @@
 
       /* Wait till there is something to do */
 
-      if (wait_for_cell)
+      if (!NILP (wait_for_cell))
 	Available = non_process_wait_mask;
       else if (! XINT (read_kbd))
 	Available = non_keyboard_wait_mask;
@@ -2723,7 +2725,7 @@
 	}
 
       /* Exit now if the cell we're waiting for became non-nil.  */
-      if (wait_for_cell && ! NILP (*wait_for_cell))
+      if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
 	break;
 
 #ifdef SIGIO
@@ -2742,7 +2744,7 @@
 
       /* If checking input just got us a size-change event from X,
 	 obey it now if we should.  */
-      if (XINT (read_kbd) || wait_for_cell)
+      if (XINT (read_kbd) || ! NILP (wait_for_cell))
 	do_pending_window_change (0);
 
       /* Check for data from a process.  */
@@ -4768,12 +4770,14 @@
   EMACS_TIME end_time, timeout;
   SELECT_TYPE waitchannels;
   int xerrno;
-  Lisp_Object *wait_for_cell = 0;
+  /* Either nil or a cons cell, the car of which is of interest and
+     may be changed outside of this routine.  */
+  Lisp_Object wait_for_cell = Qnil;
 
   /* If waiting for non-nil in a cell, record where.  */
   if (CONSP (read_kbd))
     {
-      wait_for_cell = &XCAR (read_kbd);
+      wait_for_cell = read_kbd;
       XSETFASTINT (read_kbd, 0);
     }
 
@@ -4800,7 +4804,7 @@
 	QUIT;
 
       /* Exit now if the cell we're waiting for became non-nil.  */
-      if (wait_for_cell && ! NILP (*wait_for_cell))
+      if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
 	break;
 
       /* Compute time from now till when time limit is up */
@@ -4829,7 +4833,7 @@
 	 run timer events directly.
 	 (Callers that will immediately read keyboard events
 	 call timer_delay on their own.)  */
-      if (! wait_for_cell)
+      if (NILP (wait_for_cell))
 	{
 	  EMACS_TIME timer_delay;
 
@@ -4870,7 +4874,7 @@
 
       /* Wait till there is something to do.  */
 
-      if (! XINT (read_kbd) && wait_for_cell == 0)
+      if (! XINT (read_kbd) && NILP (wait_for_cell))
 	FD_ZERO (&waitchannels);
       else
 	FD_SET (0, &waitchannels);
@@ -4946,7 +4950,7 @@
 	 input at all when wait_for_cell, but the code
 	 has been this way since July 1994.
 	 Try changing this after version 19.31.)  */
-      if (wait_for_cell
+      if (! NILP (wait_for_cell)
 	  && detect_input_pending ())
 	{
 	  swallow_events (do_display);
@@ -4955,7 +4959,7 @@
 	}
 
       /* Exit now if the cell we're waiting for became non-nil.  */
-      if (wait_for_cell && ! NILP (*wait_for_cell))
+      if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
 	break;
     }