diff options
| author | Richard M. Stallman | 1998-01-09 23:24:24 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-01-09 23:24:24 +0000 |
| commit | 5d967c7a103ce6662ee96654ea92acebc884eded (patch) | |
| tree | efd5d4143f4e1571bf85bda96e16d8597def0f5a /src | |
| parent | e361a3c34daa33743807c94971a30677e7947e9d (diff) | |
| download | emacs-5d967c7a103ce6662ee96654ea92acebc884eded.tar.gz emacs-5d967c7a103ce6662ee96654ea92acebc884eded.zip | |
(re_search_2): Fix call to CHAR_HEAD_P.
(re_match_2_internal): Use PTR_BYTE_POS and PT_BYTE.
Diffstat (limited to 'src')
| -rw-r--r-- | src/regex.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/src/regex.c b/src/regex.c index 7efb9346a35..56aeb23a8e2 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -3904,7 +3904,7 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) | |||
| 3904 | int len = 0; | 3904 | int len = 0; |
| 3905 | 3905 | ||
| 3906 | /* Find the head of multibyte form. */ | 3906 | /* Find the head of multibyte form. */ |
| 3907 | while (!CHAR_HEAD_P (p)) | 3907 | while (!CHAR_HEAD_P (*p)) |
| 3908 | p--, len++; | 3908 | p--, len++; |
| 3909 | 3909 | ||
| 3910 | /* Adjust it. */ | 3910 | /* Adjust it. */ |
| @@ -5319,15 +5319,17 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5319 | is the character at D, and S2 is the syntax of C2. */ | 5319 | is the character at D, and S2 is the syntax of C2. */ |
| 5320 | int c1, c2, s1, s2; | 5320 | int c1, c2, s1, s2; |
| 5321 | int pos1 = PTR_TO_OFFSET (d - 1); | 5321 | int pos1 = PTR_TO_OFFSET (d - 1); |
| 5322 | int charpos; | ||
| 5322 | 5323 | ||
| 5323 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); | 5324 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); |
| 5324 | GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2); | 5325 | GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2); |
| 5325 | #ifdef emacs | 5326 | #ifdef emacs |
| 5326 | UPDATE_SYNTAX_TABLE (pos1 ? pos1 : 1); | 5327 | charpos = BYTE_TO_CHAR (pos1 ? pos1 : 1); |
| 5328 | UPDATE_SYNTAX_TABLE (charpos); | ||
| 5327 | #endif | 5329 | #endif |
| 5328 | s1 = SYNTAX (c1); | 5330 | s1 = SYNTAX (c1); |
| 5329 | #ifdef emacs | 5331 | #ifdef emacs |
| 5330 | UPDATE_SYNTAX_TABLE_FORWARD (pos1 + 1); | 5332 | UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1); |
| 5331 | #endif | 5333 | #endif |
| 5332 | s2 = SYNTAX (c2); | 5334 | s2 = SYNTAX (c2); |
| 5333 | 5335 | ||
| @@ -5354,15 +5356,17 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5354 | is the character at D, and S2 is the syntax of C2. */ | 5356 | is the character at D, and S2 is the syntax of C2. */ |
| 5355 | int c1, c2, s1, s2; | 5357 | int c1, c2, s1, s2; |
| 5356 | int pos1 = PTR_TO_OFFSET (d - 1); | 5358 | int pos1 = PTR_TO_OFFSET (d - 1); |
| 5359 | int charpos; | ||
| 5357 | 5360 | ||
| 5358 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); | 5361 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); |
| 5359 | GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2); | 5362 | GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2); |
| 5360 | #ifdef emacs | 5363 | #ifdef emacs |
| 5361 | UPDATE_SYNTAX_TABLE (pos1); | 5364 | charpos = BYTE_TO_CHAR (pos1); |
| 5365 | UPDATE_SYNTAX_TABLE (charpos); | ||
| 5362 | #endif | 5366 | #endif |
| 5363 | s1 = SYNTAX (c1); | 5367 | s1 = SYNTAX (c1); |
| 5364 | #ifdef emacs | 5368 | #ifdef emacs |
| 5365 | UPDATE_SYNTAX_TABLE_FORWARD (pos1 + 1); | 5369 | UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1); |
| 5366 | #endif | 5370 | #endif |
| 5367 | s2 = SYNTAX (c2); | 5371 | s2 = SYNTAX (c2); |
| 5368 | 5372 | ||
| @@ -5389,9 +5393,11 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5389 | is the character at D, and S2 is the syntax of C2. */ | 5393 | is the character at D, and S2 is the syntax of C2. */ |
| 5390 | int c1, c2, s1, s2; | 5394 | int c1, c2, s1, s2; |
| 5391 | int pos1 = PTR_TO_OFFSET (d); | 5395 | int pos1 = PTR_TO_OFFSET (d); |
| 5396 | int charpos; | ||
| 5392 | 5397 | ||
| 5393 | GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2); | 5398 | GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2); |
| 5394 | #ifdef emacs | 5399 | #ifdef emacs |
| 5400 | charpos = BYTE_TO_CHAR (pos1); | ||
| 5395 | UPDATE_SYNTAX_TABLE (pos1); | 5401 | UPDATE_SYNTAX_TABLE (pos1); |
| 5396 | #endif | 5402 | #endif |
| 5397 | s2 = SYNTAX (c2); | 5403 | s2 = SYNTAX (c2); |
| @@ -5405,7 +5411,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5405 | { | 5411 | { |
| 5406 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); | 5412 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); |
| 5407 | #ifdef emacs | 5413 | #ifdef emacs |
| 5408 | UPDATE_SYNTAX_TABLE_BACKWARD (pos1 - 1); | 5414 | UPDATE_SYNTAX_TABLE_BACKWARD (charpos - 1); |
| 5409 | #endif | 5415 | #endif |
| 5410 | s1 = SYNTAX (c1); | 5416 | s1 = SYNTAX (c1); |
| 5411 | 5417 | ||
| @@ -5430,8 +5436,14 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5430 | /* C1 is the character before D, S1 is the syntax of C1, C2 | 5436 | /* C1 is the character before D, S1 is the syntax of C1, C2 |
| 5431 | is the character at D, and S2 is the syntax of C2. */ | 5437 | is the character at D, and S2 is the syntax of C2. */ |
| 5432 | int c1, c2, s1, s2; | 5438 | int c1, c2, s1, s2; |
| 5439 | int pos1 = PTR_TO_OFFSET (d); | ||
| 5440 | int charpos; | ||
| 5433 | 5441 | ||
| 5434 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); | 5442 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); |
| 5443 | #ifdef emacs | ||
| 5444 | charpos = BYTE_TO_CHAR (pos1 - 1); | ||
| 5445 | UPDATE_SYNTAX_TABLE (pos1); | ||
| 5446 | #endif | ||
| 5435 | s1 = SYNTAX (c1); | 5447 | s1 = SYNTAX (c1); |
| 5436 | 5448 | ||
| 5437 | /* Case 2: S1 is not Sword. */ | 5449 | /* Case 2: S1 is not Sword. */ |
| @@ -5442,6 +5454,9 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5442 | if (!AT_STRINGS_END (d)) | 5454 | if (!AT_STRINGS_END (d)) |
| 5443 | { | 5455 | { |
| 5444 | GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2); | 5456 | GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2); |
| 5457 | #ifdef emacs | ||
| 5458 | UPDATE_SYNTAX_TABLE_FORWARD (charpos); | ||
| 5459 | #endif | ||
| 5445 | s2 = SYNTAX (c2); | 5460 | s2 = SYNTAX (c2); |
| 5446 | 5461 | ||
| 5447 | /* ... and S2 is Sword, and WORD_BOUNDARY_P (C1, C2) | 5462 | /* ... and S2 is Sword, and WORD_BOUNDARY_P (C1, C2) |
| @@ -5455,19 +5470,19 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5455 | #ifdef emacs | 5470 | #ifdef emacs |
| 5456 | case before_dot: | 5471 | case before_dot: |
| 5457 | DEBUG_PRINT1 ("EXECUTING before_dot.\n"); | 5472 | DEBUG_PRINT1 ("EXECUTING before_dot.\n"); |
| 5458 | if (PTR_CHAR_POS ((unsigned char *) d) >= PT) | 5473 | if (PTR_BYTE_POS ((unsigned char *) d) >= PT_BYTE) |
| 5459 | goto fail; | 5474 | goto fail; |
| 5460 | break; | 5475 | break; |
| 5461 | 5476 | ||
| 5462 | case at_dot: | 5477 | case at_dot: |
| 5463 | DEBUG_PRINT1 ("EXECUTING at_dot.\n"); | 5478 | DEBUG_PRINT1 ("EXECUTING at_dot.\n"); |
| 5464 | if (PTR_CHAR_POS ((unsigned char *) d) != PT) | 5479 | if (PTR_BYTE_POS ((unsigned char *) d) != PT_BYTE) |
| 5465 | goto fail; | 5480 | goto fail; |
| 5466 | break; | 5481 | break; |
| 5467 | 5482 | ||
| 5468 | case after_dot: | 5483 | case after_dot: |
| 5469 | DEBUG_PRINT1 ("EXECUTING after_dot.\n"); | 5484 | DEBUG_PRINT1 ("EXECUTING after_dot.\n"); |
| 5470 | if (PTR_CHAR_POS ((unsigned char *) d) <= PT) | 5485 | if (PTR_BYTE_POS ((unsigned char *) d) <= PT_BYTE) |
| 5471 | goto fail; | 5486 | goto fail; |
| 5472 | break; | 5487 | break; |
| 5473 | 5488 | ||
| @@ -5483,7 +5498,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5483 | PREFETCH (); | 5498 | PREFETCH (); |
| 5484 | #ifdef emacs | 5499 | #ifdef emacs |
| 5485 | { | 5500 | { |
| 5486 | int pos1 = PTR_TO_OFFSET (d); | 5501 | int pos1 = BYTE_TO_CHAR (PTR_TO_OFFSET (d)); |
| 5487 | UPDATE_SYNTAX_TABLE (pos1); | 5502 | UPDATE_SYNTAX_TABLE (pos1); |
| 5488 | } | 5503 | } |
| 5489 | #endif | 5504 | #endif |
| @@ -5517,7 +5532,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5517 | PREFETCH (); | 5532 | PREFETCH (); |
| 5518 | #ifdef emacs | 5533 | #ifdef emacs |
| 5519 | { | 5534 | { |
| 5520 | int pos1 = PTR_TO_OFFSET (d); | 5535 | int pos1 = BYTE_TO_CHAR (PTR_TO_OFFSET (d)); |
| 5521 | UPDATE_SYNTAX_TABLE (pos1); | 5536 | UPDATE_SYNTAX_TABLE (pos1); |
| 5522 | } | 5537 | } |
| 5523 | #endif | 5538 | #endif |