Your analysis sounds right, thank you. I'd suggest to use another
r_alloc primitve, something like r_alloc_reset_variable, so you could do
r_alloc_reset_variable(¤t_buffer->own_text.beg);
r_alloc_reset_variable(&other_buffer->own_text.beg);
after the swap. It could use the untested patch below. WDYT?
=== modified file 'src/ralloc.c'
--- src/ralloc.c 2008-11-21 19:14:07 +0000
+++ src/ralloc.c 2008-12-23 17:23:02 +0000
@@ -402,7 +402,7 @@
while (p != NIL_BLOC)
{
- if (p->variable == ptr && p->data == *ptr)
+ if (p->data == *ptr)
return p;
p = p->next;