Variadic C functions now count arguments with size_t, not int.
[bpt/emacs.git] / src / process.c
index ec929a9..ecda8e0 100644 (file)
@@ -159,15 +159,6 @@ extern Lisp_Object QCfilter;
 #define SERIALCONN_P(p) (EQ (XPROCESS (p)->type, Qserial))
 #define SERIALCONN1_P(p) (EQ ((p)->type, Qserial))
 
-/* Define first descriptor number available for subprocesses.  */
-#define FIRST_PROC_DESC 3
-
-extern const char *get_operating_system_release (void);
-
-/* From sysdep.c or w32.c  */
-extern int serial_open (char *port);
-extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact);
-
 #ifndef HAVE_H_ERRNO
 extern int h_errno;
 #endif
@@ -284,10 +275,6 @@ static SELECT_TYPE connect_wait_mask;
 
 /* Number of bits set in connect_wait_mask.  */
 static int num_pending_connects;
-
-#define IF_NON_BLOCKING_CONNECT(s) s
-#else  /* NON_BLOCKING_CONNECT */
-#define IF_NON_BLOCKING_CONNECT(s)
 #endif /* NON_BLOCKING_CONNECT */
 
 /* The largest descriptor currently in use for a process object.  */
@@ -499,7 +486,7 @@ status_message (struct Lisp_Process *p)
            string = (code_convert_string_norecord
                      (string, Vlocale_coding_system, 0));
          c1 = STRING_CHAR (SDATA (string));
-         c2 = DOWNCASE (c1);
+         c2 = downcase (c1);
          if (c1 != c2)
            Faset (string, make_number (0), make_number (c2));
        }
@@ -541,17 +528,16 @@ static char pty_name[24];
 static int
 allocate_pty (void)
 {
-  register int c, i;
   int fd;
 
 #ifdef PTY_ITERATION
   PTY_ITERATION
 #else
+  register int c, i;
   for (c = FIRST_PTY_LETTER; c <= 'z'; c++)
     for (i = 0; i < 16; i++)
 #endif
       {
-       struct stat stb;        /* Used in some PTY_OPEN.  */
 #ifdef PTY_NAME_SPRINTF
        PTY_NAME_SPRINTF
 #else
@@ -568,6 +554,7 @@ allocate_pty (void)
               three failures in a row before deciding that we've reached the
               end of the ptys.  */
            int failed_count = 0;
+           struct stat stb;
 
            if (stat (pty_name, &stb) < 0)
              {
@@ -719,7 +706,7 @@ get_process (register Lisp_Object name)
     {
       proc = Fget_buffer_process (obj);
       if (NILP (proc))
-       error ("Buffer %s has no process", SDATA (B_ (XBUFFER (obj), name)));
+       error ("Buffer %s has no process", SDATA (BVAR (XBUFFER (obj), name)));
     }
   else
     {
@@ -1256,8 +1243,8 @@ Returns nil if format of ADDRESS is invalid.  */)
 static Lisp_Object
 list_processes_1 (Lisp_Object query_only)
 {
-  register Lisp_Object tail, tem;
-  Lisp_Object proc, minspace, tem1;
+  register Lisp_Object tail;
+  Lisp_Object proc, minspace;
   register struct Lisp_Process *p;
   char tembuf[300];
   int w_proc, w_buffer, w_tty;
@@ -1283,12 +1270,12 @@ list_processes_1 (Lisp_Object query_only)
        w_proc = i;
       if (!NILP (p->buffer))
        {
-         if (NILP (B_ (XBUFFER (p->buffer), name)))
+         if (NILP (BVAR (XBUFFER (p->buffer), name)))
            {
              if (w_buffer < 8)
                w_buffer = 8;  /* (Killed) */
            }
-         else if ((i = SCHARS (B_ (XBUFFER (p->buffer), name)), (i > w_buffer)))
+         else if ((i = SCHARS (BVAR (XBUFFER (p->buffer), name)), (i > w_buffer)))
            w_buffer = i;
        }
       if (STRINGP (p->tty_name)
@@ -1312,9 +1299,9 @@ list_processes_1 (Lisp_Object query_only)
   XSETFASTINT (minspace, 1);
 
   set_buffer_internal (XBUFFER (Vstandard_output));
-  B_ (current_buffer, undo_list) = Qt;
+  BVAR (current_buffer, undo_list) = Qt;
 
-  B_ (current_buffer, truncate_lines) = Qt;
+  BVAR (current_buffer, truncate_lines) = Qt;
 
   write_string ("Proc", -1);
   Findent_to (i_status, minspace); write_string ("Status", -1);
@@ -1397,10 +1384,10 @@ list_processes_1 (Lisp_Object query_only)
       Findent_to (i_buffer, minspace);
       if (NILP (p->buffer))
        insert_string ("(none)");
-      else if (NILP (B_ (XBUFFER (p->buffer), name)))
+      else if (NILP (BVAR (XBUFFER (p->buffer), name)))
        insert_string ("(Killed)");
       else
-       Finsert (1, &B_ (XBUFFER (p->buffer), name));
+       Finsert (1, &BVAR (XBUFFER (p->buffer), name));
 
       if (!NILP (i_tty))
        {
@@ -1459,10 +1446,10 @@ list_processes_1 (Lisp_Object query_only)
        }
       else
        {
-         tem = p->command;
+         Lisp_Object tem = p->command;
          while (1)
            {
-             tem1 = Fcar (tem);
+             Lisp_Object tem1 = Fcar (tem);
              if (NILP (tem1))
                break;
              Finsert (1, &tem1);
@@ -1525,11 +1512,11 @@ the command through a shell and redirect one of them using the shell
 syntax.
 
 usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)  */)
-  (int nargs, register Lisp_Object *args)
+  (size_t nargs, register Lisp_Object *args)
 {
   Lisp_Object buffer, name, program, proc, current_dir, tem;
   register unsigned char **new_argv;
-  register int i;
+  register size_t i;
   int count = SPECPDL_INDEX ();
 
   buffer = args[1];
@@ -1548,7 +1535,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)  */)
   {
     struct gcpro gcpro1, gcpro2;
 
-    current_dir = B_ (current_buffer, directory);
+    current_dir = BVAR (current_buffer, directory);
 
     GCPRO2 (buffer, current_dir);
 
@@ -1560,7 +1547,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)  */)
     current_dir = expand_and_dir_to_file (current_dir, Qnil);
     if (NILP (Ffile_accessible_directory_p (current_dir)))
       report_file_error ("Setting current directory",
-                        Fcons (B_ (current_buffer, directory), Qnil));
+                        Fcons (BVAR (current_buffer, directory), Qnil));
 
     UNGCPRO;
   }
@@ -1660,9 +1647,9 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)  */)
   }
 
 
-  XPROCESS (proc)->decoding_buf = make_uninit_string (0);
+  XPROCESS (proc)->decoding_buf = empty_unibyte_string;
   XPROCESS (proc)->decoding_carryover = 0;
-  XPROCESS (proc)->encoding_buf = make_uninit_string (0);
+  XPROCESS (proc)->encoding_buf = empty_unibyte_string;
 
   XPROCESS (proc)->inherit_coding_system_flag
     = !(NILP (buffer) || !inherit_process_coding_system);
@@ -1735,7 +1722,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)  */)
       new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *));
       new_argv[nargs - 2] = 0;
 
-      for (i = nargs - 3; i >= 0; i--)
+      for (i = nargs - 2; i-- != 0; )
        {
          new_argv[i] = SDATA (XCAR (tem));
          tem = XCDR (tem);
@@ -1925,8 +1912,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
     /* child_setup must clobber environ on systems with true vfork.
        Protect it from permanent change.  */
     char **save_environ = environ;
-
-    current_dir = ENCODE_FILE (current_dir);
+    volatile Lisp_Object encoded_current_dir = ENCODE_FILE (current_dir);
 
 #ifndef WINDOWSNT
     pid = vfork ();
@@ -2067,13 +2053,13 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
          child_setup_tty (xforkout);
 #ifdef WINDOWSNT
        pid = child_setup (xforkin, xforkout, xforkout,
-                          new_argv, 1, current_dir);
+                          new_argv, 1, encoded_current_dir);
 #else  /* not WINDOWSNT */
 #ifdef FD_CLOEXEC
        emacs_close (wait_child_setup[0]);
 #endif
        child_setup (xforkin, xforkout, xforkout,
-                    new_argv, 1, current_dir);
+                    new_argv, 1, encoded_current_dir);
 #endif /* not WINDOWSNT */
       }
     environ = save_environ;
@@ -2695,7 +2681,7 @@ Examples:
 \(serial-process-configure :port "\\\\.\\COM13" :bytesize 7)
 
 usage: (serial-process-configure &rest ARGS)  */)
-  (int nargs, Lisp_Object *args)
+  (size_t nargs, Lisp_Object *args)
 {
   struct Lisp_Process *p;
   Lisp_Object contact = Qnil;
@@ -2730,7 +2716,8 @@ usage: (serial-process-configure &rest ARGS)  */)
 }
 
 /* Used by make-serial-process to recover from errors.  */
-Lisp_Object make_serial_process_unwind (Lisp_Object proc)
+static Lisp_Object
+make_serial_process_unwind (Lisp_Object proc)
 {
   if (!PROCESSP (proc))
     abort ();
@@ -2812,7 +2799,7 @@ Examples:
 \(make-serial-process :port "/dev/tty.BlueConsole-SPP-1" :speed nil)
 
 usage:  (make-serial-process &rest ARGS)  */)
-  (int nargs, Lisp_Object *args)
+  (size_t nargs, Lisp_Object *args)
 {
   int fd = -1;
   Lisp_Object proc, contact, port;
@@ -2898,8 +2885,8 @@ usage:  (make-serial-process &rest ARGS)  */)
     }
   else if (!NILP (Vcoding_system_for_read))
     val = Vcoding_system_for_read;
-  else if ((!NILP (buffer) && NILP (B_ (XBUFFER (buffer), enable_multibyte_characters)))
-          || (NILP (buffer) && NILP (B_ (&buffer_defaults, enable_multibyte_characters))))
+  else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
+          || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
     val = Qnil;
   p->decode_coding_system = val;
 
@@ -2912,15 +2899,15 @@ usage:  (make-serial-process &rest ARGS)  */)
     }
   else if (!NILP (Vcoding_system_for_write))
     val = Vcoding_system_for_write;
-  else if ((!NILP (buffer) && NILP (B_ (XBUFFER (buffer), enable_multibyte_characters)))
-          || (NILP (buffer) && NILP (B_ (&buffer_defaults, enable_multibyte_characters))))
+  else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
+          || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
     val = Qnil;
   p->encode_coding_system = val;
 
   setup_process_coding_systems (proc);
-  p->decoding_buf = make_uninit_string (0);
+  p->decoding_buf = empty_unibyte_string;
   p->decoding_carryover = 0;
-  p->encoding_buf = make_uninit_string (0);
+  p->encoding_buf = empty_unibyte_string;
   p->inherit_coding_system_flag
     = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
 
@@ -3090,7 +3077,7 @@ The original argument list, modified with the actual connection
 information, is available via the `process-contact' function.
 
 usage: (make-network-process &rest ARGS)  */)
-  (int nargs, Lisp_Object *args)
+  (size_t nargs, Lisp_Object *args)
 {
   Lisp_Object proc;
   Lisp_Object contact;
@@ -3406,9 +3393,12 @@ usage: (make-network-process &rest ARGS)  */)
 
   for (lres = res; lres; lres = lres->ai_next)
     {
-      int optn, optbits;
+      size_t optn;
+      int optbits;
 
+#ifdef WINDOWSNT
     retry_connect:
+#endif
 
       s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol);
       if (s < 0)
@@ -3472,7 +3462,7 @@ usage: (make-network-process &rest ARGS)  */)
          if (EQ (service, Qt))
            {
              struct sockaddr_in sa1;
-             int len1 = sizeof (sa1);
+             socklen_t len1 = sizeof (sa1);
              if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0)
                {
                  ((struct sockaddr_in *)(lres->ai_addr))->sin_port = sa1.sin_port;
@@ -3519,7 +3509,8 @@ usage: (make-network-process &rest ARGS)  */)
          /* Unlike most other syscalls connect() cannot be called
             again.  (That would return EALREADY.)  The proper way to
             wait for completion is select(). */
-         int sc, len;
+         int sc;
+         socklen_t len;
          SELECT_TYPE fdset;
        retry_select:
          FD_ZERO (&fdset);
@@ -3592,7 +3583,7 @@ usage: (make-network-process &rest ARGS)  */)
       if (!is_server)
        {
          struct sockaddr_in sa1;
-         int len1 = sizeof (sa1);
+         socklen_t len1 = sizeof (sa1);
          if (getsockname (s, (struct sockaddr *)&sa1, &len1) == 0)
            contact = Fplist_put (contact, QClocal,
                                  conv_sockaddr_to_lisp ((struct sockaddr *)&sa1, len1));
@@ -3710,10 +3701,10 @@ usage: (make-network-process &rest ARGS)  */)
 
   {
     /* Setup coding systems for communicating with the network stream.  */
-    struct gcpro gcpro1;
+    struct gcpro inner_gcpro1;
     /* Qt denotes we have not yet called Ffind_operation_coding_system.  */
     Lisp_Object coding_systems = Qt;
-    Lisp_Object args[5], val;
+    Lisp_Object fargs[5], val;
 
     if (!NILP (tem))
       {
@@ -3723,8 +3714,8 @@ usage: (make-network-process &rest ARGS)  */)
       }
     else if (!NILP (Vcoding_system_for_read))
       val = Vcoding_system_for_read;
-    else if ((!NILP (buffer) && NILP (B_ (XBUFFER (buffer), enable_multibyte_characters)))
-            || (NILP (buffer) && NILP (B_ (&buffer_defaults, enable_multibyte_characters))))
+    else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
+            || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
       /* We dare not decode end-of-line format by setting VAL to
         Qraw_text, because the existing Emacs Lisp libraries
         assume that they receive bare code including a sequene of
@@ -3736,11 +3727,11 @@ usage: (make-network-process &rest ARGS)  */)
          coding_systems = Qnil;
        else
          {
-           args[0] = Qopen_network_stream, args[1] = name,
-             args[2] = buffer, args[3] = host, args[4] = service;
-           GCPRO1 (proc);
-           coding_systems = Ffind_operation_coding_system (5, args);
-           UNGCPRO;
+           fargs[0] = Qopen_network_stream, fargs[1] = name,
+             fargs[2] = buffer, fargs[3] = host, fargs[4] = service;
+           GCPRO1_VAR (proc, inner_gcpro);
+           coding_systems = Ffind_operation_coding_system (5, fargs);
+           UNGCPRO_VAR (inner_gcpro);
          }
        if (CONSP (coding_systems))
          val = XCAR (coding_systems);
@@ -3759,7 +3750,7 @@ usage: (make-network-process &rest ARGS)  */)
       }
     else if (!NILP (Vcoding_system_for_write))
       val = Vcoding_system_for_write;
-    else if (NILP (B_ (current_buffer, enable_multibyte_characters)))
+    else if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
       val = Qnil;
     else
       {
@@ -3769,11 +3760,11 @@ usage: (make-network-process &rest ARGS)  */)
              coding_systems = Qnil;
            else
              {
-               args[0] = Qopen_network_stream, args[1] = name,
-                 args[2] = buffer, args[3] = host, args[4] = service;
-               GCPRO1 (proc);
-               coding_systems = Ffind_operation_coding_system (5, args);
-               UNGCPRO;
+               fargs[0] = Qopen_network_stream, fargs[1] = name,
+                 fargs[2] = buffer, fargs[3] = host, fargs[4] = service;
+               GCPRO1_VAR (proc, inner_gcpro);
+               coding_systems = Ffind_operation_coding_system (5, fargs);
+               UNGCPRO_VAR (inner_gcpro);
              }
          }
        if (CONSP (coding_systems))
@@ -3787,9 +3778,9 @@ usage: (make-network-process &rest ARGS)  */)
   }
   setup_process_coding_systems (proc);
 
-  p->decoding_buf = make_uninit_string (0);
+  p->decoding_buf = empty_unibyte_string;
   p->decoding_carryover = 0;
-  p->encoding_buf = make_uninit_string (0);
+  p->encoding_buf = empty_unibyte_string;
 
   p->inherit_coding_system_flag
     = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
@@ -3953,7 +3944,7 @@ FLAGS is the current flags of the interface.  */)
   CHECK_STRING (ifname);
 
   memset (rq.ifr_name, 0, sizeof rq.ifr_name);
-  strncpy (rq.ifr_name, SDATA (ifname), sizeof (rq.ifr_name));
+  strncpy (rq.ifr_name, SSDATA (ifname), sizeof (rq.ifr_name));
 
   s = socket (AF_INET, SOCK_STREAM, 0);
   if (s < 0)
@@ -4197,7 +4188,7 @@ server_accept_connection (Lisp_Object server, int channel)
     struct sockaddr_un un;
 #endif
   } saddr;
-  int len = sizeof saddr;
+  socklen_t len = sizeof saddr;
 
   s = accept (channel, &saddr.sa, &len);
 
@@ -4364,9 +4355,9 @@ server_accept_connection (Lisp_Object server, int channel)
   p->encode_coding_system = ps->encode_coding_system;
   setup_process_coding_systems (proc);
 
-  p->decoding_buf = make_uninit_string (0);
+  p->decoding_buf = empty_unibyte_string;
   p->decoding_carryover = 0;
-  p->encoding_buf = make_uninit_string (0);
+  p->encoding_buf = empty_unibyte_string;
 
   p->inherit_coding_system_flag
     = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag);
@@ -4558,7 +4549,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
              struct buffer *old_buffer = current_buffer;
              Lisp_Object old_window = selected_window;
 
-             timer_delay = timer_check (1);
+             timer_delay = timer_check ();
 
              /* If a timer has run, this might have changed buffers
                 an alike.  Make read_key_sequence aware of that.  */
@@ -4933,8 +4924,6 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
             d->func (channel, d->data, 0);
           }
 
-      /* Really FIRST_PROC_DESC should be 0 on Unix,
-        but this is safer in the short run.  */
       for (channel = 0; channel <= max_process_desc; channel++)
        {
          if (FD_ISSET (channel, &Available)
@@ -5064,7 +5053,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
              /* getsockopt(,,SO_ERROR,,) is said to hang on some systems.
                 So only use it on systems where it is known to work.  */
              {
-               int xlen = sizeof (xerrno);
+               socklen_t xlen = sizeof (xerrno);
                if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen))
                  xerrno = errno;
              }
@@ -5133,9 +5122,9 @@ read_process_output_call (Lisp_Object fun_and_args)
 }
 
 static Lisp_Object
-read_process_output_error_handler (Lisp_Object error)
+read_process_output_error_handler (Lisp_Object error_val)
 {
-  cmd_error_internal (error, "error in process filter: ");
+  cmd_error_internal (error_val, "error in process filter: ");
   Vinhibit_quit = Qt;
   update_echo_area ();
   Fsleep_for (make_number (2), Qnil);
@@ -5176,7 +5165,7 @@ read_process_output (Lisp_Object proc, register int channel)
   /* We have a working select, so proc_buffered_char is always -1.  */
   if (DATAGRAM_CHAN_P (channel))
     {
-      int len = datagram_address[channel].len;
+      socklen_t len = datagram_address[channel].len;
       nbytes = recvfrom (channel, chars + carryover, readmax,
                         0, datagram_address[channel].sa, &len);
     }
@@ -5268,7 +5257,7 @@ read_process_output (Lisp_Object proc, register int channel)
       /* No need to gcpro these, because all we do with them later
         is test them for EQness, and none of them should be a string.  */
       XSETBUFFER (obuffer, current_buffer);
-      okeymap = B_ (current_buffer, keymap);
+      okeymap = BVAR (current_buffer, keymap);
 
       /* We inhibit quit here instead of just catching it so that
         hitting ^G when a filter happens to be running won't screw
@@ -5359,7 +5348,7 @@ read_process_output (Lisp_Object proc, register int channel)
     }
 
   /* If no filter, write into buffer if it isn't dead.  */
-  else if (!NILP (p->buffer) && !NILP (B_ (XBUFFER (p->buffer), name)))
+  else if (!NILP (p->buffer) && !NILP (BVAR (XBUFFER (p->buffer), name)))
     {
       Lisp_Object old_read_only;
       EMACS_INT old_begv, old_zv;
@@ -5372,13 +5361,13 @@ read_process_output (Lisp_Object proc, register int channel)
       Fset_buffer (p->buffer);
       opoint = PT;
       opoint_byte = PT_BYTE;
-      old_read_only = B_ (current_buffer, read_only);
+      old_read_only = BVAR (current_buffer, read_only);
       old_begv = BEGV;
       old_zv = ZV;
       old_begv_byte = BEGV_BYTE;
       old_zv_byte = ZV_BYTE;
 
-      B_ (current_buffer, read_only) = Qnil;
+      BVAR (current_buffer, read_only) = Qnil;
 
       /* Insert new output into buffer
         at the current end-of-output marker,
@@ -5423,7 +5412,7 @@ read_process_output (Lisp_Object proc, register int channel)
          p->decoding_carryover = coding->carryover_bytes;
        }
       /* Adjust the multibyteness of TEXT to that of the buffer.  */
-      if (NILP (B_ (current_buffer, enable_multibyte_characters))
+      if (NILP (BVAR (current_buffer, enable_multibyte_characters))
          != ! STRING_MULTIBYTE (text))
        text = (STRING_MULTIBYTE (text)
                ? Fstring_as_unibyte (text)
@@ -5467,7 +5456,7 @@ read_process_output (Lisp_Object proc, register int channel)
        Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
 
 
-      B_ (current_buffer, read_only) = old_read_only;
+      BVAR (current_buffer, read_only) = old_read_only;
       SET_PT_BOTH (opoint, opoint_byte);
     }
   /* Handling the process output should not deactivate the mark.  */
@@ -5482,7 +5471,7 @@ read_process_output (Lisp_Object proc, register int channel)
 jmp_buf send_process_frame;
 Lisp_Object process_sent_to;
 
-SIGTYPE
+static SIGTYPE
 send_process_trap (int ignore)
 {
   SIGNAL_THREAD_CHECK (SIGPIPE);
@@ -5525,7 +5514,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
 
   if ((STRINGP (object) && STRING_MULTIBYTE (object))
       || (BUFFERP (object)
-         && !NILP (B_ (XBUFFER (object), enable_multibyte_characters)))
+         && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters)))
       || EQ (object, Qt))
     {
       p->encode_coding_system
@@ -5930,7 +5919,7 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
 
       if (sig_char && *sig_char != CDISABLE)
        {
-         send_process (proc, sig_char, 1, Qnil);
+         send_process (proc, (char *) sig_char, 1, Qnil);
          return;
        }
       /* If we can't send the signal with a character,
@@ -6391,7 +6380,7 @@ process has been transmitted to the serial port.  */)
    indirectly; if it does, that is a bug  */
 
 #ifdef SIGCHLD
-SIGTYPE
+static SIGTYPE
 sigchld_handler (int signo)
 {
   int old_errno = errno;
@@ -6539,9 +6528,9 @@ exec_sentinel_unwind (Lisp_Object data)
 }
 
 static Lisp_Object
-exec_sentinel_error_handler (Lisp_Object error)
+exec_sentinel_error_handler (Lisp_Object error_val)
 {
-  cmd_error_internal (error, "error in process sentinel: ");
+  cmd_error_internal (error_val, "error in process sentinel: ");
   Vinhibit_quit = Qt;
   update_echo_area ();
   Fsleep_for (make_number (2), Qnil);
@@ -6564,7 +6553,7 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
      is test them for EQness, and none of them should be a string.  */
   odeactivate = Vdeactivate_mark;
   XSETBUFFER (obuffer, current_buffer);
-  okeymap = B_ (current_buffer, keymap);
+  okeymap = BVAR (current_buffer, keymap);
 
   /* There's no good reason to let sentinels change the current
      buffer, and many callers of accept-process-output, sit-for, and
@@ -6714,7 +6703,7 @@ status_notify (struct Lisp_Process *deleting_process)
 
              /* Avoid error if buffer is deleted
                 (probably that's why the process is dead, too) */
-             if (NILP (B_ (XBUFFER (buffer), name)))
+             if (NILP (BVAR (XBUFFER (buffer), name)))
                continue;
              Fset_buffer (buffer);
 
@@ -6731,13 +6720,13 @@ status_notify (struct Lisp_Process *deleting_process)
              before = PT;
              before_byte = PT_BYTE;
 
-             tem = B_ (current_buffer, read_only);
-             B_ (current_buffer, read_only) = Qnil;
+             tem = BVAR (current_buffer, read_only);
+             BVAR (current_buffer, read_only) = Qnil;
              insert_string ("\nProcess ");
              Finsert (1, &p->name);
              insert_string (" ");
              Finsert (1, &msg);
-             B_ (current_buffer, read_only) = tem;
+             BVAR (current_buffer, read_only) = tem;
              set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
 
              if (opoint >= before)
@@ -6958,7 +6947,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
          do
            {
              int old_timers_run = timers_run;
-             timer_delay = timer_check (1);
+             timer_delay = timer_check ();
              if (timers_run != old_timers_run && do_display)
                /* We must retry, since a timer may have requeued itself
                   and that could alter the time delay.  */
@@ -7136,7 +7125,7 @@ setup_process_coding_systems (Lisp_Object process)
     ;
   else if (BUFFERP (p->buffer))
     {
-      if (NILP (B_ (XBUFFER (p->buffer), enable_multibyte_characters)))
+      if (NILP (BVAR (XBUFFER (p->buffer), enable_multibyte_characters)))
        coding_system = raw_text_coding_system (coding_system);
     }
   setup_coding_system (coding_system, proc_decode_coding_system[inch]);