* src/profiler.c: Delete.
[bpt/emacs.git] / src / undo.c
index 2dde02b..66b038e 100644 (file)
@@ -328,10 +328,8 @@ truncate_undo_list (struct buffer *b)
   Lisp_Object list;
   Lisp_Object prev, next, last_boundary;
   EMACS_INT size_so_far = 0;
-
-  /* Make sure that calling undo-outer-limit-function
-     won't cause another GC.  */
-  ptrdiff_t count = inhibit_garbage_collection ();
+  dynwind_begin ();
+  static const size_t sizeof_cons = sizeof (scm_t_cell);
 
   /* Make the buffer current to get its local values of variables such
      as undo_limit.  Also so that Vundo_outer_limit_function can
@@ -349,7 +347,7 @@ truncate_undo_list (struct buffer *b)
   if (CONSP (next) && NILP (XCAR (next)))
     {
       /* Add in the space occupied by this element and its chain link.  */
-      size_so_far += sizeof (struct Lisp_Cons);
+      size_so_far += sizeof_cons;
 
       /* Advance to next element.  */
       prev = next;
@@ -368,10 +366,10 @@ truncate_undo_list (struct buffer *b)
       elt = XCAR (next);
 
       /* Add in the space occupied by this element and its chain link.  */
-      size_so_far += sizeof (struct Lisp_Cons);
+      size_so_far += sizeof_cons;
       if (CONSP (elt))
        {
-         size_so_far += sizeof (struct Lisp_Cons);
+         size_so_far += sizeof_cons;
          if (STRINGP (XCAR (elt)))
            size_so_far += (sizeof (struct Lisp_String) - 1
                            + SCHARS (XCAR (elt)));
@@ -397,7 +395,7 @@ truncate_undo_list (struct buffer *b)
        {
          /* The function is responsible for making
             any desired changes in buffer-undo-list.  */
-         unbind_to (count, Qnil);
+         dynwind_end ();
          return;
        }
       /* That function probably used the minibuffer, and if so, that
@@ -429,10 +427,10 @@ truncate_undo_list (struct buffer *b)
        }
 
       /* Add in the space occupied by this element and its chain link.  */
-      size_so_far += sizeof (struct Lisp_Cons);
+      size_so_far += sizeof_cons;
       if (CONSP (elt))
        {
-         size_so_far += sizeof (struct Lisp_Cons);
+         size_so_far += sizeof_cons;
          if (STRINGP (XCAR (elt)))
            size_so_far += (sizeof (struct Lisp_String) - 1
                            + SCHARS (XCAR (elt)));
@@ -453,13 +451,15 @@ truncate_undo_list (struct buffer *b)
   else
     bset_undo_list (b, Qnil);
 
-  unbind_to (count, Qnil);
+  dynwind_end ();
 }
 
 \f
 void
 syms_of_undo (void)
 {
+#include "undo.x"
+
   DEFSYM (Qinhibit_read_only, "inhibit-read-only");
   DEFSYM (Qapply, "apply");
 
@@ -469,8 +469,6 @@ syms_of_undo (void)
   last_undo_buffer = NULL;
   last_boundary_buffer = NULL;
 
-  defsubr (&Sundo_boundary);
-
   DEFVAR_INT ("undo-limit", undo_limit,
              doc: /* Keep no more undo information once it exceeds this size.
 This limit is applied when garbage collection happens.