+2012-05-23 Eli Zaretskii <eliz@gnu.org>
+
+ * charset.c (maybe_unify_char): Inhibit relocation of buffer text
+ for the duration of call to load_charset, to avoid problems with
+ callers of maybe_unify_char that access buffer text through C
+ pointers.
+
+ * ralloc.c (r_alloc_inhibit_buffer_relocation): Increment and
+ decrement the inhibition flag, instead of just setting or
+ resetting it.
+
2012-05-24 Ken Brown <kbrown@cornell.edu>
* callproc.c (Fcall_process): Restore a line that was accidentally
return c;
CHECK_CHARSET_GET_CHARSET (val, charset);
+#ifdef REL_ALLOC
+ /* The call to load_charset below can allocate memory, whcih screws
+ callers of this function through STRING_CHAR_* macros that hold C
+ pointers to buffer text, if REL_ALLOC is used. */
+ r_alloc_inhibit_buffer_relocation (1);
+#endif
load_charset (charset, 1);
if (! inhibit_load_charset_map)
{
if (unified > 0)
c = unified;
}
+#ifdef REL_ALLOC
+ r_alloc_inhibit_buffer_relocation (0);
+#endif
return c;
}
void
r_alloc_inhibit_buffer_relocation (int inhibit)
{
- use_relocatable_buffers = !inhibit;
+ if (use_relocatable_buffers < 0)
+ use_relocatable_buffers = 0;
+ if (inhibit)
+ use_relocatable_buffers++;
+ else if (use_relocatable_buffers > 0)
+ use_relocatable_buffers--;
}
\f