use dynwind_begin and dynwind_end
[bpt/emacs.git] / src / sysdep.c
index 211a3bb..e8b0057 100644 (file)
@@ -1950,9 +1950,6 @@ init_signals (bool dumping)
 #ifdef SIGVTALRM
   sigaction (SIGVTALRM, &process_fatal_action, 0);
 #endif
-#ifdef SIGXCPU
-  sigaction (SIGXCPU, &process_fatal_action, 0);
-#endif
 #ifdef SIGXFSZ
   sigaction (SIGXFSZ, &process_fatal_action, 0);
 #endif
@@ -2953,7 +2950,7 @@ system_process_attributes (Lisp_Object pid)
   if (gr)
     attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
 
-  count = SPECPDL_INDEX ();
+  dynwind_begin ();
   strcpy (fn, procfn);
   procfn_end = fn + strlen (fn);
   strcpy (procfn_end, "/stat");
@@ -3064,7 +3061,7 @@ system_process_attributes (Lisp_Object pid)
          attrs = Fcons (Fcons (Qpmem, make_float (pmem)), attrs);
        }
     }
-  unbind_to (count, Qnil);
+  dynwind_end ();
 
   /* args */
   strcpy (procfn_end, "/cmdline");
@@ -3072,14 +3069,13 @@ system_process_attributes (Lisp_Object pid)
   if (fd >= 0)
     {
       ptrdiff_t readsize, nread_incr;
+      dynwind_begin ();
       record_unwind_protect_int (close_file_unwind, fd);
-      record_unwind_protect_nothing ();
       nread = cmdline_size = 0;
 
       do
        {
          cmdline = xpalloc (cmdline, &cmdline_size, 2, STRING_BYTES_BOUND, 1);
-         set_unwind_protect_ptr (count + 1, xfree, cmdline);
 
          /* Leave room even if every byte needs escaping below.  */
          readsize = (cmdline_size >> 1) - nread;
@@ -3113,14 +3109,13 @@ system_process_attributes (Lisp_Object pid)
          nread = cmdsize + 2;
          cmdline_size = nread + 1;
          q = cmdline = xrealloc (cmdline, cmdline_size);
-         set_unwind_protect_ptr (count + 1, xfree, cmdline);
          sprintf (cmdline, "[%.*s]", cmdsize, cmd);
        }
       /* Command line is encoded in locale-coding-system; decode it.  */
       cmd_str = make_unibyte_string (q, nread);
       decoded_cmd = code_convert_string_norecord (cmd_str,
                                                  Vlocale_coding_system, 0);
-      unbind_to (count, Qnil);
+      dynwind_end ();
       attrs = Fcons (Fcons (Qargs, decoded_cmd), attrs);
     }
 
@@ -3191,7 +3186,7 @@ system_process_attributes (Lisp_Object pid)
   if (gr)
     attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
 
-  count = SPECPDL_INDEX ();
+  dynwind_begin ();
   strcpy (fn, procfn);
   procfn_end = fn + strlen (fn);
   strcpy (procfn_end, "/psinfo");
@@ -3265,7 +3260,7 @@ system_process_attributes (Lisp_Object pid)
                      Vlocale_coding_system, 0));
       attrs = Fcons (Fcons (Qargs, decoded_cmd), attrs);
     }
-  unbind_to (count, Qnil);
+  dynwind_end ();
   UNGCPRO;
   return attrs;
 }