[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/src ChangeLog buffer.c ralloc.c
From: |
Jason Rumney |
Subject: |
[Emacs-diffs] emacs/src ChangeLog buffer.c ralloc.c |
Date: |
Wed, 24 Dec 2008 11:20:37 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Jason Rumney <jasonr> 08/12/24 11:20:36
Modified files:
src : ChangeLog buffer.c ralloc.c
Log message:
* ralloc.c (r_alloc_reset_variable): New function.
* buffer.c (Fbuffer_swap_text) [REL_ALLOC]: Reset ralloc's internal
record of what points where.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/ChangeLog?cvsroot=emacs&r1=1.7224&r2=1.7225
http://cvs.savannah.gnu.org/viewcvs/emacs/src/buffer.c?cvsroot=emacs&r1=1.576&r2=1.577
http://cvs.savannah.gnu.org/viewcvs/emacs/src/ralloc.c?cvsroot=emacs&r1=1.69&r2=1.70
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/src/ChangeLog,v
retrieving revision 1.7224
retrieving revision 1.7225
diff -u -b -r1.7224 -r1.7225
--- ChangeLog 22 Dec 2008 20:45:52 -0000 1.7224
+++ ChangeLog 24 Dec 2008 11:20:32 -0000 1.7225
@@ -1,3 +1,10 @@
+2008-12-24 Jason Rumney <address@hidden>
+
+ * ralloc.c (r_alloc_reset_variable): New function.
+
+ * buffer.c (Fbuffer_swap_text) [REL_ALLOC]: Reset ralloc's internal
+ record of what points where.
+
2008-12-22 Dan Nicolaescu <address@hidden>
* minibuf.c (read_minibuf): Follow the non-interactive case when
Index: buffer.c
===================================================================
RCS file: /sources/emacs/emacs/src/buffer.c,v
retrieving revision 1.576
retrieving revision 1.577
diff -u -b -r1.576 -r1.577
--- buffer.c 22 Dec 2008 09:48:22 -0000 1.576
+++ buffer.c 24 Dec 2008 11:20:35 -0000 1.577
@@ -2182,6 +2182,10 @@
return byte_pos;
}
+#ifdef REL_ALLOC
+extern void r_alloc_reset_variable P_ ((PTR *, PTR *));
+#endif /* REL_ALLOC */
+
DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
1, 1, 0,
doc: /* Swap the text between current buffer and BUFFER. */)
@@ -2223,6 +2227,13 @@
swapfield (own_text, struct buffer_text);
eassert (current_buffer->text == ¤t_buffer->own_text);
eassert (other_buffer->text == &other_buffer->own_text);
+#ifdef REL_ALLOC
+ r_alloc_reset_variable ((PTR *) ¤t_buffer->own_text.beg,
+ (PTR *) &other_buffer->own_text.beg);
+ r_alloc_reset_variable ((PTR *) &other_buffer->own_text.beg,
+ (PTR *) ¤t_buffer->own_text.beg);
+#endif /* REL_ALLOC */
+
swapfield (pt, EMACS_INT);
swapfield (pt_byte, EMACS_INT);
swapfield (begv, EMACS_INT);
Index: ralloc.c
===================================================================
RCS file: /sources/emacs/emacs/src/ralloc.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -b -r1.69 -r1.70
--- ralloc.c 21 Nov 2008 12:14:07 -0000 1.69
+++ ralloc.c 24 Dec 2008 11:20:36 -0000 1.70
@@ -1223,6 +1223,34 @@
#endif /* DEBUG */
+/* Update the internal record of which variable points to some data to NEW.
+ Used by buffer-swap-text in Emacs to restore consistency after it
+ swaps the buffer text between two buffer objects. The OLD pointer
+ is checked to ensure that memory corruption does not occur due to
+ misuse. */
+void
+r_alloc_reset_variable (old, new)
+ POINTER *old, *new;
+{
+ bloc_ptr bloc = first_bloc;
+
+ /* Find the bloc that corresponds to the data pointed to by pointer.
+ find_bloc cannot be used, as it has internal consistency checks
+ which fail when the variable needs reseting. */
+ while (bloc != NIL_BLOC)
+ {
+ if (bloc->data == *new)
+ break;
+
+ bloc = bloc->next;
+ }
+
+ if (bloc == NIL_BLOC || bloc->variable != old)
+ abort ();
+
+ /* Update variable to point to the new location. */
+ bloc->variable = new;
+}
/***********************************************************************
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs/src ChangeLog buffer.c ralloc.c,
Jason Rumney <=