use dynwind_begin and dynwind_end
[bpt/emacs.git] / src / coding.c
index 3fffeb4..fc21795 100644 (file)
@@ -7879,7 +7879,7 @@ void
 decode_coding_gap (struct coding_system *coding,
                   ptrdiff_t chars, ptrdiff_t bytes)
 {
-  ptrdiff_t count = SPECPDL_INDEX ();
+  dynwind_begin ();
   Lisp_Object attrs;
 
   coding->src_object = Fcurrent_buffer ();
@@ -7973,6 +7973,7 @@ decode_coding_gap (struct coding_system *coding,
          coding->produced = bytes;
          coding->produced_char = chars;
          insert_from_gap (chars, bytes, 1);
+         dynwind_end ();
          return;
        }
     }
@@ -7996,7 +7997,7 @@ decode_coding_gap (struct coding_system *coding,
       coding->produced += Z_BYTE - prev_Z_BYTE;
     }
 
-  unbind_to (count, Qnil);
+  dynwind_end ();
 }
 
 
@@ -8036,7 +8037,7 @@ decode_coding_object (struct coding_system *coding,
                      ptrdiff_t to, ptrdiff_t to_byte,
                      Lisp_Object dst_object)
 {
-  ptrdiff_t count = SPECPDL_INDEX ();
+  dynwind_begin ();
   unsigned char *destination IF_LINT (= NULL);
   ptrdiff_t dst_bytes IF_LINT (= 0);
   ptrdiff_t chars = to - from;
@@ -8209,7 +8210,7 @@ decode_coding_object (struct coding_system *coding,
     }
 
   Vdeactivate_mark = old_deactivate_mark;
-  unbind_to (count, coding->dst_object);
+  dynwind_end ();
 }
 
 
@@ -8220,7 +8221,7 @@ encode_coding_object (struct coding_system *coding,
                      ptrdiff_t to, ptrdiff_t to_byte,
                      Lisp_Object dst_object)
 {
-  ptrdiff_t count = SPECPDL_INDEX ();
+  dynwind_begin ();
   ptrdiff_t chars = to - from;
   ptrdiff_t bytes = to_byte - from_byte;
   Lisp_Object attrs;
@@ -8418,7 +8419,7 @@ encode_coding_object (struct coding_system *coding,
     Fkill_buffer (coding->src_object);
 
   Vdeactivate_mark = old_deactivate_mark;
-  unbind_to (count, Qnil);
+  dynwind_end ();
 }
 
 
@@ -8516,7 +8517,7 @@ are lower-case).  */)
   (Lisp_Object prompt, Lisp_Object default_coding_system)
 {
   Lisp_Object val;
-  ptrdiff_t count = SPECPDL_INDEX ();
+  dynwind_begin ();
 
   if (SYMBOLP (default_coding_system))
     default_coding_system = SYMBOL_NAME (default_coding_system);
@@ -8524,7 +8525,7 @@ are lower-case).  */)
   val = Fcompleting_read (prompt, Vcoding_system_alist, Qnil,
                          Qt, Qnil, Qcoding_system_history,
                          default_coding_system, Qnil);
-  unbind_to (count, Qnil);
+  dynwind_end ();
   return (SCHARS (val) == 0 ? Qnil : Fintern (val, Qnil));
 }
 
@@ -10797,6 +10798,8 @@ init_coding_once (void)
 void
 syms_of_coding (void)
 {
+#include "coding.x"
+
   staticpro (&Vcoding_system_hash_table);
   {
     Lisp_Object args[2];
@@ -10958,39 +10961,6 @@ syms_of_coding (void)
   DEFSYM (Qinterrupted, "interrupted");
   DEFSYM (Qcoding_system_define_form, "coding-system-define-form");
 
-  defsubr (&Scoding_system_p);
-  defsubr (&Sread_coding_system);
-  defsubr (&Sread_non_nil_coding_system);
-  defsubr (&Scheck_coding_system);
-  defsubr (&Sdetect_coding_region);
-  defsubr (&Sdetect_coding_string);
-  defsubr (&Sfind_coding_systems_region_internal);
-  defsubr (&Sunencodable_char_position);
-  defsubr (&Scheck_coding_systems_region);
-  defsubr (&Sdecode_coding_region);
-  defsubr (&Sencode_coding_region);
-  defsubr (&Sdecode_coding_string);
-  defsubr (&Sencode_coding_string);
-  defsubr (&Sdecode_sjis_char);
-  defsubr (&Sencode_sjis_char);
-  defsubr (&Sdecode_big5_char);
-  defsubr (&Sencode_big5_char);
-  defsubr (&Sset_terminal_coding_system_internal);
-  defsubr (&Sset_safe_terminal_coding_system_internal);
-  defsubr (&Sterminal_coding_system);
-  defsubr (&Sset_keyboard_coding_system_internal);
-  defsubr (&Skeyboard_coding_system);
-  defsubr (&Sfind_operation_coding_system);
-  defsubr (&Sset_coding_system_priority);
-  defsubr (&Sdefine_coding_system_internal);
-  defsubr (&Sdefine_coding_system_alias);
-  defsubr (&Scoding_system_put);
-  defsubr (&Scoding_system_base);
-  defsubr (&Scoding_system_plist);
-  defsubr (&Scoding_system_aliases);
-  defsubr (&Scoding_system_eol_type);
-  defsubr (&Scoding_system_priority_list);
-
   DEFVAR_LISP ("coding-system-list", Vcoding_system_list,
               doc: /* List of coding systems.