comparison src/search.c @ 112434:9de5a68b57e1

Promote SSDATA macro from gtkutil.c and xsmfns.c to lisp.h.
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 22 Jan 2011 18:56:06 -0800
parents 42e22c4f06b7
children
comparison
equal deleted inserted replaced
112433:7b649f6eac4f 112434:9de5a68b57e1
151 if (STRINGP (Vsearch_spaces_regexp)) 151 if (STRINGP (Vsearch_spaces_regexp))
152 re_set_whitespace_regexp (SDATA (Vsearch_spaces_regexp)); 152 re_set_whitespace_regexp (SDATA (Vsearch_spaces_regexp));
153 else 153 else
154 re_set_whitespace_regexp (NULL); 154 re_set_whitespace_regexp (NULL);
155 155
156 val = (char *) re_compile_pattern ((char *) SDATA (pattern), 156 val = (char *) re_compile_pattern (SSDATA (pattern),
157 SBYTES (pattern), &cp->buf); 157 SBYTES (pattern), &cp->buf);
158 158
159 /* If the compiled pattern hard codes some of the contents of the 159 /* If the compiled pattern hard codes some of the contents of the
160 syntax-table, it can only be reused with *this* syntax table. */ 160 syntax-table, it can only be reused with *this* syntax table. */
161 cp->syntax_table = cp->buf.used_syntax ? current_buffer->syntax_table : Qt; 161 cp->syntax_table = cp->buf.used_syntax ? current_buffer->syntax_table : Qt;
412 posix, 412 posix,
413 STRING_MULTIBYTE (string)); 413 STRING_MULTIBYTE (string));
414 immediate_quit = 1; 414 immediate_quit = 1;
415 re_match_object = string; 415 re_match_object = string;
416 416
417 val = re_search (bufp, (char *) SDATA (string), 417 val = re_search (bufp, SSDATA (string),
418 SBYTES (string), pos_byte, 418 SBYTES (string), pos_byte,
419 SBYTES (string) - pos_byte, 419 SBYTES (string) - pos_byte,
420 (NILP (Vinhibit_changing_match_data) 420 (NILP (Vinhibit_changing_match_data)
421 ? &search_regs : NULL)); 421 ? &search_regs : NULL));
422 immediate_quit = 0; 422 immediate_quit = 0;
483 bufp = compile_pattern (regexp, 0, Qnil, 483 bufp = compile_pattern (regexp, 0, Qnil,
484 0, STRING_MULTIBYTE (string)); 484 0, STRING_MULTIBYTE (string));
485 immediate_quit = 1; 485 immediate_quit = 1;
486 re_match_object = string; 486 re_match_object = string;
487 487
488 val = re_search (bufp, (char *) SDATA (string), 488 val = re_search (bufp, SSDATA (string),
489 SBYTES (string), 0, 489 SBYTES (string), 0,
490 SBYTES (string), 0); 490 SBYTES (string), 0);
491 immediate_quit = 0; 491 immediate_quit = 0;
492 return val; 492 return val;
493 } 493 }
526 bufp = compile_pattern (regexp, 0, Vascii_canon_table, 526 bufp = compile_pattern (regexp, 0, Vascii_canon_table,
527 0, STRING_MULTIBYTE (string)); 527 0, STRING_MULTIBYTE (string));
528 immediate_quit = 1; 528 immediate_quit = 1;
529 re_match_object = string; 529 re_match_object = string;
530 530
531 val = re_search (bufp, (char *) SDATA (string), 531 val = re_search (bufp, SSDATA (string),
532 SBYTES (string), 0, 532 SBYTES (string), 0,
533 SBYTES (string), 0); 533 SBYTES (string), 0);
534 immediate_quit = 0; 534 immediate_quit = 0;
535 return val; 535 return val;
536 } 536 }
1266 We must convert PATTERN to match that, or we will not really 1266 We must convert PATTERN to match that, or we will not really
1267 find things right. */ 1267 find things right. */
1268 1268
1269 if (multibyte == STRING_MULTIBYTE (string)) 1269 if (multibyte == STRING_MULTIBYTE (string))
1270 { 1270 {
1271 raw_pattern = (unsigned char *) SDATA (string); 1271 raw_pattern = SDATA (string);
1272 raw_pattern_size = SCHARS (string); 1272 raw_pattern_size = SCHARS (string);
1273 raw_pattern_size_byte = SBYTES (string); 1273 raw_pattern_size_byte = SBYTES (string);
1274 } 1274 }
1275 else if (multibyte) 1275 else if (multibyte)
1276 { 1276 {
3252 defsubr (&Smatch_end); 3252 defsubr (&Smatch_end);
3253 defsubr (&Smatch_data); 3253 defsubr (&Smatch_data);
3254 defsubr (&Sset_match_data); 3254 defsubr (&Sset_match_data);
3255 defsubr (&Sregexp_quote); 3255 defsubr (&Sregexp_quote);
3256 } 3256 }
3257