aboutsummaryrefslogtreecommitdiffstats
path: root/src/ralloc.c
diff options
context:
space:
mode:
authorEli Zaretskii <[email protected]>2012-05-28 19:50:10 +0300
committerEli Zaretskii <[email protected]>2012-05-28 19:50:10 +0300
commit291d430f5f184c8a9438eace09b141131de343e8 (patch)
tree6310a9eb6bbf4643505fa67d0b012dad81624aa0 /src/ralloc.c
parente383e32d7a00bf286db1dc6b05b6219f0eaab8dc (diff)
Avoid buffer text relocations in calls to STRING_CHAR_* macros.
src/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. src/ralloc.c (r_alloc_inhibit_buffer_relocation): Increment and decrement the inhibition flag, instead of just setting or resetting it. Fixes: debbugs:11519
Diffstat (limited to 'src/ralloc.c')
-rw-r--r--src/ralloc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ralloc.c b/src/ralloc.c
index db3638a54e..2e4823dc6c 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -1204,7 +1204,12 @@ r_alloc_reset_variable (POINTER *old, POINTER *new)
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--;
}