aboutsummaryrefslogtreecommitdiffstats
path: root/src/search.c
diff options
context:
space:
mode:
authorGlenn Morris2012-05-26 18:06:44 -0700
committerGlenn Morris2012-05-26 18:06:44 -0700
commit33017fafd17d722e82a268e9b272f27df261e09d (patch)
tree9c34640f09d51059804961d697ed9b07e19571d3 /src/search.c
parentcaf8a9b2b301aba06735d403317b75b41df59bfe (diff)
parented7bebbb489cf6f893fc35a2a6714b0d8e7e8a90 (diff)
downloademacs-33017fafd17d722e82a268e9b272f27df261e09d.tar.gz
emacs-33017fafd17d722e82a268e9b272f27df261e09d.zip
Merge from emacs-24; up to 2012-04-24T08:35:02Z!lekktu@gmail.com
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/search.c b/src/search.c
index a9542a2ed97..5608e344e75 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1159,12 +1159,25 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
1159 while (n < 0) 1159 while (n < 0)
1160 { 1160 {
1161 ptrdiff_t val; 1161 ptrdiff_t val;
1162
1163#ifdef REL_ALLOC
1164 /* re_search_2 below is passed C pointers to buffer text.
1165 If some code called by it causes memory (re)allocation,
1166 buffer text could be relocated on platforms that use
1167 REL_ALLOC, which invalidates those C pointers. So we
1168 inhibit relocation of buffer text for as long as
1169 re_search_2 runs. */
1170 r_alloc_inhibit_buffer_relocation (1);
1171#endif
1162 val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2, 1172 val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2,
1163 pos_byte - BEGV_BYTE, lim_byte - pos_byte, 1173 pos_byte - BEGV_BYTE, lim_byte - pos_byte,
1164 (NILP (Vinhibit_changing_match_data) 1174 (NILP (Vinhibit_changing_match_data)
1165 ? &search_regs : &search_regs_1), 1175 ? &search_regs : &search_regs_1),
1166 /* Don't allow match past current point */ 1176 /* Don't allow match past current point */
1167 pos_byte - BEGV_BYTE); 1177 pos_byte - BEGV_BYTE);
1178#ifdef REL_ALLOC
1179 r_alloc_inhibit_buffer_relocation (0);
1180#endif
1168 if (val == -2) 1181 if (val == -2)
1169 { 1182 {
1170 matcher_overflow (); 1183 matcher_overflow ();
@@ -1203,11 +1216,20 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
1203 while (n > 0) 1216 while (n > 0)
1204 { 1217 {
1205 ptrdiff_t val; 1218 ptrdiff_t val;
1219
1220#ifdef REL_ALLOC
1221 /* See commentary above for the reasons for inhibiting
1222 buffer text relocation here. */
1223 r_alloc_inhibit_buffer_relocation (1);
1224#endif
1206 val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2, 1225 val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2,
1207 pos_byte - BEGV_BYTE, lim_byte - pos_byte, 1226 pos_byte - BEGV_BYTE, lim_byte - pos_byte,
1208 (NILP (Vinhibit_changing_match_data) 1227 (NILP (Vinhibit_changing_match_data)
1209 ? &search_regs : &search_regs_1), 1228 ? &search_regs : &search_regs_1),
1210 lim_byte - BEGV_BYTE); 1229 lim_byte - BEGV_BYTE);
1230#ifdef REL_ALLOC
1231 r_alloc_inhibit_buffer_relocation (0);
1232#endif
1211 if (val == -2) 1233 if (val == -2)
1212 { 1234 {
1213 matcher_overflow (); 1235 matcher_overflow ();