use dynwind_begin and dynwind_end
[bpt/emacs.git] / src / print.c
index 5ff3b5b..6ed0f51 100644 (file)
@@ -100,7 +100,7 @@ bool print_output_debug_flag EXTERNALLY_VISIBLE = 1;
    struct buffer *old = current_buffer;                                        \
    ptrdiff_t old_point = -1, start_point = -1;                         \
    ptrdiff_t old_point_byte = -1, start_point_byte = -1;               \
-   ptrdiff_t specpdl_count = SPECPDL_INDEX ();                         \
+   dynwind_begin ();                                                    \
    bool free_print_buffer = 0;                                         \
    bool multibyte                                                      \
      = !NILP (BVAR (current_buffer, enable_multibyte_characters));     \
@@ -185,7 +185,7 @@ bool print_output_debug_flag EXTERNALLY_VISIBLE = 1;
        xfree (print_buffer);                                           \
        print_buffer = 0;                                               \
      }                                                                 \
-   unbind_to (specpdl_count, Qnil);                                    \
+   dynwind_end ();                                                      \
    if (MARKERP (original))                                             \
      set_marker_both (original, Qnil, PT, PT_BYTE);                    \
    if (old_point >= 0)                                                 \
@@ -478,10 +478,10 @@ write_string_1 (const char *data, int size, Lisp_Object printcharfun)
 void
 temp_output_buffer_setup (const char *bufname)
 {
-  ptrdiff_t count = SPECPDL_INDEX ();
   register struct buffer *old = current_buffer;
   register Lisp_Object buf;
 
+  dynwind_begin ();
   record_unwind_current_buffer ();
 
   Fset_buffer (Fget_buffer_create (build_string (bufname)));
@@ -503,7 +503,7 @@ temp_output_buffer_setup (const char *bufname)
 
   Frun_hooks (1, &Qtemp_buffer_setup_hook);
 
-  unbind_to (count, Qnil);
+  dynwind_end ();
 
   specbind (Qstandard_output, buf);
 }
@@ -583,9 +583,9 @@ A printed representation of an object is text which describes that object.  */)
   bool prev_abort_on_gc;
   /* struct gcpro gcpro1, gcpro2; */
   Lisp_Object save_deactivate_mark;
-  ptrdiff_t count = SPECPDL_INDEX ();
   struct buffer *previous;
 
+  dynwind_begin ();
   specbind (Qinhibit_modification_hooks, Qt);
 
   {
@@ -619,7 +619,8 @@ A printed representation of an object is text which describes that object.  */)
   Vdeactivate_mark = save_deactivate_mark;
   /* UNGCPRO; */
 
-  return unbind_to (count, object);
+  dynwind_end ();
+  return object;
 }
 
 DEFUN ("princ", Fprinc, Sprinc, 1, 2, 0,