diff options
| author | Stefan Monnier | 2000-03-14 00:27:57 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2000-03-14 00:27:57 +0000 |
| commit | 66f0296e4897de71e31a1663d4b92d580476e2b2 (patch) | |
| tree | b9622b13082f428cb56d652782663157a69c3387 /src/charset.h | |
| parent | a735b7e1cff3f1a5bfa20b4388f5d3da41491a53 (diff) | |
| download | emacs-66f0296e4897de71e31a1663d4b92d580476e2b2.tar.gz emacs-66f0296e4897de71e31a1663d4b92d580476e2b2.zip | |
* regex.c: Declare a new type `re_char' used throughout the code for the
string char type. It's `const unsigned char' to match the rest of Emacs.
Consistently make sure all pointers to strings use it and make sure all
pointers into the pattern use `unsigned char'.
(re_match_2_internal): Use `PREFETCH+STRING_CHAR' instead of
GET_CHAR_AFTER_2.
Also merge wordbound and notwordbound to reduce code duplication.
* charset.h (GET_CHAR_AFTER_2): Remove.
(GET_CHAR_BEFORE_2): Use unsigned chars, like everywhere else.
Diffstat (limited to 'src/charset.h')
| -rw-r--r-- | src/charset.h | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/charset.h b/src/charset.h index 6b2e25b89dd..3acc447c5f8 100644 --- a/src/charset.h +++ b/src/charset.h | |||
| @@ -577,26 +577,15 @@ else | |||
| 577 | ? 1 \ | 577 | ? 1 \ |
| 578 | : multibyte_form_length (str, len)) | 578 | : multibyte_form_length (str, len)) |
| 579 | 579 | ||
| 580 | /* Set C a (possibly multibyte) character at P. P points into a | ||
| 581 | string which is the virtual concatenation of STR1 (which ends at | ||
| 582 | END1) or STR2 (which ends at END2). */ | ||
| 583 | |||
| 584 | #define GET_CHAR_AFTER_2(c, p, str1, end1, str2, end2) \ | ||
| 585 | do { \ | ||
| 586 | const char *dtemp = (p) == (end1) ? (str2) : (p); \ | ||
| 587 | const char *dlimit = ((p) >= (str1) && (p) < (end1)) ? (end1) : (end2); \ | ||
| 588 | c = STRING_CHAR (dtemp, dlimit - dtemp); \ | ||
| 589 | } while (0) | ||
| 590 | |||
| 591 | /* Set C a (possibly multibyte) character before P. P points into a | 580 | /* Set C a (possibly multibyte) character before P. P points into a |
| 592 | string which is the virtual concatenation of STR1 (which ends at | 581 | string which is the virtual concatenation of STR1 (which ends at |
| 593 | END1) or STR2 (which ends at END2). */ | 582 | END1) or STR2 (which ends at END2). */ |
| 594 | 583 | ||
| 595 | #define GET_CHAR_BEFORE_2(c, p, str1, end1, str2, end2) \ | 584 | #define GET_CHAR_BEFORE_2(c, p, str1, end1, str2, end2) \ |
| 596 | do { \ | 585 | do { \ |
| 597 | const char *dtemp = (p); \ | 586 | const unsigned char *dtemp = (p); \ |
| 598 | const char *dlimit = ((p) > (str2) && (p) <= (end2)) ? (str2) : (str1); \ | 587 | const unsigned char *dlimit = ((p) > (str2) && (p) <= (end2)) ? (str2) : (str1); \ |
| 599 | while (dtemp-- > dlimit && (unsigned char) *dtemp >= 0xA0); \ | 588 | while (dtemp-- > dlimit && *dtemp >= 0xA0); \ |
| 600 | c = STRING_CHAR (dtemp, p - dtemp); \ | 589 | c = STRING_CHAR (dtemp, p - dtemp); \ |
| 601 | } while (0) | 590 | } while (0) |
| 602 | 591 | ||