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.
/* Clean up files, file descriptors and processes created by Fcall_process. */
static void
-delete_temp_file_ptr (Lisp_Object *name_ptr)
+delete_temp_file (Lisp_Object name)
{
- Lisp_Object name = *name_ptr;
if (! NILP (name))
unlink (SSDATA (name));
}
+static void
+delete_temp_file_ptr (Lisp_Object *name_ptr)
+{
+ if (name_ptr)
+ delete_temp_file (*name_ptr);
+}
+
static void
call_process_kill (void *ptr)
{
synch_process_pid = 0;
}
else if (STRINGP (synch_process_tempfile))
- delete_temp_file_ptr (&synch_process_tempfile);
+ delete_temp_file (synch_process_tempfile);
}
/* Clean up when exiting Fcall_process: restore the buffer, and
Lisp_Object infile, encoded_infile;
int filefd;
struct gcpro gcpro1;
- ptrdiff_t count = SPECPDL_INDEX ();
+ dynwind_begin ();
if (nargs >= 2 && ! NILP (args[1]))
{
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.
int callproc_fd[CALLPROC_FDS];
int status;
ptrdiff_t i;
- ptrdiff_t count = SPECPDL_INDEX ();
USE_SAFE_ALLOCA;
char **new_argv;
Lisp_Object coding_systems;
bool discard_output;
+ dynwind_begin ();
+
if (synch_process_pid)
error ("call-process invoked recursively");
if (pid < 0)
{
child_errno = errno;
- unbind_to (count, Qnil);
+ dynwind_end ();
synchronize_system_messages_locale ();
return
code_convert_string_norecord (build_string (strerror (child_errno)),
bool volatile display_p_volatile = display_p;
int volatile fd_error_volatile = fd_error;
int *volatile filefd_volatile = filefd;
- ptrdiff_t volatile count_volatile = count;
char **volatile new_argv_volatile = new_argv;
int volatile callproc_fd_volatile[CALLPROC_FDS];
for (i = 0; i < CALLPROC_FDS; i++)
display_p = display_p_volatile;
fd_error = fd_error_volatile;
filefd = filefd_volatile;
- count = count_volatile;
new_argv = new_argv_volatile;
for (i = 0; i < CALLPROC_FDS; i++)
#endif /* not MSDOS */
if (INTEGERP (buffer))
- return unbind_to (count, Qnil);
+ {
+ dynwind_end ();
+ return Qnil;
+ }
if (BUFFERP (buffer))
Fset_buffer (buffer);
else
{ /* We have to decode the input. */
Lisp_Object curbuf;
- ptrdiff_t count1 = SPECPDL_INDEX ();
+ dynwind_begin ();
XSETBUFFER (curbuf, current_buffer);
/* FIXME: Call signal_after_change! */
prepare_to_modify_buffer (PT, PT, NULL);
specbind (Qinhibit_modification_hooks, Qt);
decode_coding_c_string (&process_coding,
(unsigned char *) buf, nread, curbuf);
- unbind_to (count1, Qnil);
+ dynwind_end ();
if (display_on_the_fly
&& CODING_REQUIRE_DETECTION (&saved_coding)
&& ! CODING_REQUIRE_DETECTION (&process_coding))
synch_process_pid = 0;
SAFE_FREE ();
- unbind_to (count, Qnil);
+ dynwind_end ();
if (WIFSIGNALED (status))
{
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
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)
{
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;
args[1] = infile;
val = call_process (nargs, args, &fd, &infile);
- RETURN_UNGCPRO (unbind_to (count, val));
+ dynwind_end ();
+ return val;
}
\f
#ifndef WINDOWSNT