use dynwind_begin and dynwind_end
[bpt/emacs.git] / src / callproc.c
index 2f6030f..56bdc7d 100644 (file)
@@ -128,7 +128,7 @@ encode_current_directory (void)
     report_file_error ("Setting current directory",
                       BVAR (current_buffer, directory));
 
-  RETURN_UNGCPRO (dir);
+  return dir;
 }
 
 /* If P is reapable, record it as a deleted process and kill it.
@@ -245,7 +245,7 @@ usage: (call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS)  *
   Lisp_Object infile, encoded_infile;
   int filefd;
   struct gcpro gcpro1;
-  ptrdiff_t count = SPECPDL_INDEX ();
+  dynwind_begin ();
 
   if (nargs >= 2 && ! NILP (args[1]))
     {
@@ -263,7 +263,9 @@ usage: (call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS)  *
     report_file_error ("Opening process input file", infile);
   record_unwind_protect_ptr (close_file_ptr_unwind, &filefd);
   UNGCPRO;
-  return unbind_to (count, call_process (nargs, args, &filefd, NULL));
+  Lisp_Object tem0 = call_process (nargs, args, &filefd, NULL);
+  dynwind_end ();
+  return tem0;
 }
 
 /* Like Fcall_process (NARGS, ARGS), except use FILEFD as the input file.
@@ -1007,7 +1009,7 @@ create_temp_file (ptrdiff_t nargs, Lisp_Object *args,
   val = complement_process_encoding_system (val);
 
   {
-    ptrdiff_t count1 = SPECPDL_INDEX ();
+    dynwind_begin ();
 
     specbind (intern ("coding-system-for-write"), val);
     /* POSIX lets mk[s]temp use "."; don't invoke jka-compr if we
@@ -1015,7 +1017,7 @@ create_temp_file (ptrdiff_t nargs, Lisp_Object *args,
     specbind (intern ("file-name-handler-alist"), Qnil);
     write_region (start, end, filename_string, Qnil, Qlambda, Qnil, Qnil, fd);
 
-    unbind_to (count1, Qnil);
+    dynwind_end ();
   }
 
   if (lseek (fd, 0, SEEK_SET) < 0)
@@ -1056,7 +1058,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
 {
   struct gcpro gcpro1;
   Lisp_Object infile, val;
-  ptrdiff_t count = SPECPDL_INDEX ();
+  dynwind_begin ();
   Lisp_Object start = args[0];
   Lisp_Object end = args[1];
   bool empty_input;
@@ -1103,7 +1105,8 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
   args[1] = infile;
 
   val = call_process (nargs, args, &fd, &infile);
-  RETURN_UNGCPRO (unbind_to (count, val));
+  dynwind_end ();
+  return val;
 }
 \f
 #ifndef WINDOWSNT