aboutsummaryrefslogtreecommitdiffstats
path: root/src/search.c
diff options
context:
space:
mode:
authorTom Tromey2018-08-09 17:56:53 -0600
committerTom Tromey2018-08-09 17:56:53 -0600
commitaccb7b7ecc19f85c2750ded1046a464bc73c6a52 (patch)
tree1aa94af022d6700a93a8ff2b73f5b210046ac010 /src/search.c
parentf822a2516d88eeb2118fbbc8554f155e86dfd74e (diff)
parent53483df0de0085dbc9ef0b15a0f629ab808b0147 (diff)
downloademacs-accb7b7ecc19f85c2750ded1046a464bc73c6a52.tar.gz
emacs-accb7b7ecc19f85c2750ded1046a464bc73c6a52.zip
Merge remote-tracking branch 'origin/master' into feature/bignum
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/search.c b/src/search.c
index 5385c890f98..f5c771963ea 100644
--- a/src/search.c
+++ b/src/search.c
@@ -30,7 +30,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
30#include "blockinput.h" 30#include "blockinput.h"
31#include "intervals.h" 31#include "intervals.h"
32 32
33#include "regex.h" 33#include "regex-emacs.h"
34 34
35#define REGEXP_CACHE_SIZE 20 35#define REGEXP_CACHE_SIZE 20
36 36
@@ -59,8 +59,8 @@ static struct regexp_cache searchbufs[REGEXP_CACHE_SIZE];
59static struct regexp_cache *searchbuf_head; 59static struct regexp_cache *searchbuf_head;
60 60
61 61
62/* Every call to re_match, etc., must pass &search_regs as the regs 62/* Every call to re_search, etc., must pass &search_regs as the regs
63 argument unless you can show it is unnecessary (i.e., if re_match 63 argument unless you can show it is unnecessary (i.e., if re_search
64 is certainly going to be called again before region-around-match 64 is certainly going to be called again before region-around-match
65 can be called). 65 can be called).
66 66
@@ -132,7 +132,7 @@ compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern,
132 132
133 eassert (!cp->busy); 133 eassert (!cp->busy);
134 cp->regexp = Qnil; 134 cp->regexp = Qnil;
135 cp->buf.translate = (! NILP (translate) ? translate : make_fixnum (0)); 135 cp->buf.translate = translate;
136 cp->posix = posix; 136 cp->posix = posix;
137 cp->buf.multibyte = STRING_MULTIBYTE (pattern); 137 cp->buf.multibyte = STRING_MULTIBYTE (pattern);
138 cp->buf.charset_unibyte = charset_unibyte; 138 cp->buf.charset_unibyte = charset_unibyte;
@@ -238,7 +238,7 @@ compile_pattern (Lisp_Object pattern, struct re_registers *regp,
238 && !cp->busy 238 && !cp->busy
239 && STRING_MULTIBYTE (cp->regexp) == STRING_MULTIBYTE (pattern) 239 && STRING_MULTIBYTE (cp->regexp) == STRING_MULTIBYTE (pattern)
240 && !NILP (Fstring_equal (cp->regexp, pattern)) 240 && !NILP (Fstring_equal (cp->regexp, pattern))
241 && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_fixnum (0))) 241 && EQ (cp->buf.translate, translate)
242 && cp->posix == posix 242 && cp->posix == posix
243 && (EQ (cp->syntax_table, Qt) 243 && (EQ (cp->syntax_table, Qt)
244 || EQ (cp->syntax_table, BVAR (current_buffer, syntax_table))) 244 || EQ (cp->syntax_table, BVAR (current_buffer, syntax_table)))
@@ -290,7 +290,8 @@ looking_at_1 (Lisp_Object string, bool posix)
290 if (running_asynch_code) 290 if (running_asynch_code)
291 save_search_regs (); 291 save_search_regs ();
292 292
293 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 293 /* This is so set_image_of_range_1 in regex-emacs.c can find the EQV
294 table. */
294 set_char_table_extras (BVAR (current_buffer, case_canon_table), 2, 295 set_char_table_extras (BVAR (current_buffer, case_canon_table), 2,
295 BVAR (current_buffer, case_eqv_table)); 296 BVAR (current_buffer, case_eqv_table));
296 297
@@ -410,7 +411,8 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start,
410 pos_byte = string_char_to_byte (string, pos); 411 pos_byte = string_char_to_byte (string, pos);
411 } 412 }
412 413
413 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 414 /* This is so set_image_of_range_1 in regex-emacs.c can find the EQV
415 table. */
414 set_char_table_extras (BVAR (current_buffer, case_canon_table), 2, 416 set_char_table_extras (BVAR (current_buffer, case_canon_table), 2,
415 BVAR (current_buffer, case_eqv_table)); 417 BVAR (current_buffer, case_eqv_table));
416 418
@@ -1062,7 +1064,8 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
1062 lim_byte = CHAR_TO_BYTE (lim); 1064 lim_byte = CHAR_TO_BYTE (lim);
1063 } 1065 }
1064 1066
1065 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 1067 /* This is so set_image_of_range_1 in regex-emacs.c can find the EQV
1068 table. */
1066 set_char_table_extras (BVAR (current_buffer, case_canon_table), 2, 1069 set_char_table_extras (BVAR (current_buffer, case_canon_table), 2,
1067 BVAR (current_buffer, case_eqv_table)); 1070 BVAR (current_buffer, case_eqv_table));
1068 1071
@@ -2186,8 +2189,8 @@ set_search_regs (ptrdiff_t beg_byte, ptrdiff_t nbytes)
2186 the match position. */ 2189 the match position. */
2187 if (search_regs.num_regs == 0) 2190 if (search_regs.num_regs == 0)
2188 { 2191 {
2189 search_regs.start = xmalloc (2 * sizeof (regoff_t)); 2192 search_regs.start = xmalloc (2 * sizeof *search_regs.start);
2190 search_regs.end = xmalloc (2 * sizeof (regoff_t)); 2193 search_regs.end = xmalloc (2 * sizeof *search_regs.end);
2191 search_regs.num_regs = 2; 2194 search_regs.num_regs = 2;
2192 } 2195 }
2193 2196
@@ -2998,9 +3001,9 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere. */)
2998 memory_full (SIZE_MAX); 3001 memory_full (SIZE_MAX);
2999 search_regs.start = 3002 search_regs.start =
3000 xpalloc (search_regs.start, &num_regs, length - num_regs, 3003 xpalloc (search_regs.start, &num_regs, length - num_regs,
3001 min (PTRDIFF_MAX, UINT_MAX), sizeof (regoff_t)); 3004 min (PTRDIFF_MAX, UINT_MAX), sizeof *search_regs.start);
3002 search_regs.end = 3005 search_regs.end =
3003 xrealloc (search_regs.end, num_regs * sizeof (regoff_t)); 3006 xrealloc (search_regs.end, num_regs * sizeof *search_regs.end);
3004 3007
3005 for (i = search_regs.num_regs; i < num_regs; i++) 3008 for (i = search_regs.num_regs; i < num_regs; i++)
3006 search_regs.start[i] = -1; 3009 search_regs.start[i] = -1;
@@ -3055,12 +3058,9 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere. */)
3055 XSETFASTINT (marker, 0); 3058 XSETFASTINT (marker, 0);
3056 3059
3057 CHECK_FIXNUM_COERCE_MARKER (marker); 3060 CHECK_FIXNUM_COERCE_MARKER (marker);
3058 if ((XFIXNUM (from) < 0 3061 if (PTRDIFF_MIN <= XFIXNUM (from) && XFIXNUM (from) <= PTRDIFF_MAX
3059 ? TYPE_MINIMUM (regoff_t) <= XFIXNUM (from) 3062 && PTRDIFF_MIN <= XFIXNUM (marker)
3060 : XFIXNUM (from) <= TYPE_MAXIMUM (regoff_t)) 3063 && XFIXNUM (marker) <= PTRDIFF_MAX)
3061 && (XFIXNUM (marker) < 0
3062 ? TYPE_MINIMUM (regoff_t) <= XFIXNUM (marker)
3063 : XFIXNUM (marker) <= TYPE_MAXIMUM (regoff_t)))
3064 { 3064 {
3065 search_regs.start[i] = XFIXNUM (from); 3065 search_regs.start[i] = XFIXNUM (from);
3066 search_regs.end[i] = XFIXNUM (marker); 3066 search_regs.end[i] = XFIXNUM (marker);