aboutsummaryrefslogtreecommitdiffstats
path: root/src/ralloc.c
diff options
context:
space:
mode:
authorJason Rumney2008-12-24 11:20:32 +0000
committerJason Rumney2008-12-24 11:20:32 +0000
commitbaae5c2d8453b653cb1cffd638d9bd90064d6275 (patch)
tree41bcf421e601d5b290a026005b07d17ea49f21fe /src/ralloc.c
parentb08ddfb407a2017fd781fadf6cc2573909a2b664 (diff)
downloademacs-baae5c2d8453b653cb1cffd638d9bd90064d6275.tar.gz
emacs-baae5c2d8453b653cb1cffd638d9bd90064d6275.zip
* ralloc.c (r_alloc_reset_variable): New function.
* buffer.c (Fbuffer_swap_text) [REL_ALLOC]: Reset ralloc's internal record of what points where.
Diffstat (limited to 'src/ralloc.c')
-rw-r--r--src/ralloc.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/ralloc.c b/src/ralloc.c
index 30ed888697f..61f7aff95f5 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -1223,6 +1223,34 @@ r_alloc_check ()
1223 1223
1224#endif /* DEBUG */ 1224#endif /* DEBUG */
1225 1225
1226/* Update the internal record of which variable points to some data to NEW.
1227 Used by buffer-swap-text in Emacs to restore consistency after it
1228 swaps the buffer text between two buffer objects. The OLD pointer
1229 is checked to ensure that memory corruption does not occur due to
1230 misuse. */
1231void
1232r_alloc_reset_variable (old, new)
1233 POINTER *old, *new;
1234{
1235 bloc_ptr bloc = first_bloc;
1236
1237 /* Find the bloc that corresponds to the data pointed to by pointer.
1238 find_bloc cannot be used, as it has internal consistency checks
1239 which fail when the variable needs reseting. */
1240 while (bloc != NIL_BLOC)
1241 {
1242 if (bloc->data == *new)
1243 break;
1244
1245 bloc = bloc->next;
1246 }
1247
1248 if (bloc == NIL_BLOC || bloc->variable != old)
1249 abort ();
1250
1251 /* Update variable to point to the new location. */
1252 bloc->variable = new;
1253}
1226 1254
1227 1255
1228/*********************************************************************** 1256/***********************************************************************