summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2016-11-04 10:36:02 +0200
committerEli Zaretskii <eliz@gnu.org>2016-11-04 10:36:02 +0200
commit0221b7a9b511db2ebcbe5f41c1fa20d2f3d70599 (patch)
treeacdc0e1150ccebdea24e7596e7cd2433a0803472 /src/search.c
parent5043e0a7e06dbf6507a59736e55bdde69d9a2a4e (diff)
downloademacs-0221b7a9b511db2ebcbe5f41c1fa20d2f3d70599.tar.gz
Mark relocation workarounds with REL_ALLOC
* src/search.c (boyer_moore): Mark workarounds for ralloc.c relocation of buffer text with "#ifdef REL_ALLOC".
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/search.c b/src/search.c
index 15504be042b..9f55d728362 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2029,20 +2029,27 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
cursor += dirlen - i - direction; /* fix cursor */
if (i + direction == 0)
{
- ptrdiff_t position, start, end, cursor_off;
+ ptrdiff_t position, start, end;
+#ifdef REL_ALLOC
+ ptrdiff_t cursor_off;
+#endif
cursor -= direction;
position = pos_byte + cursor - p2 + ((direction > 0)
? 1 - len_byte : 0);
+#ifdef REL_ALLOC
/* set_search_regs might call malloc, which could
cause ralloc.c relocate buffer text. We need to
update pointers into buffer text due to that. */
cursor_off = cursor - p2;
+#endif
set_search_regs (position, len_byte);
+#ifdef REL_ALLOC
p_limit = BYTE_POS_ADDR (limit);
p2 = BYTE_POS_ADDR (pos_byte);
cursor = p2 + cursor_off;
+#endif
if (NILP (Vinhibit_changing_match_data))
{