Commit 2d1675e4 authored by Stefan Monnier's avatar Stefan Monnier

* regex.c (PTR_TO_OFFSET) [!emacs]: Remove.

(RE_MULTIBYTE_P, RE_STRING_CHAR_AND_LENGTH): New macros.
(GET_CHAR_BEFORE_2): Moved from charset.h plus fixed minor bug when
we are between str1 and str2.
(MAX_MULTIBYTE_LENGTH, CHAR_STRING) [!emacs]: Provide trivial default.
(PATFETCH): Use `TRANSLATE'.
(PATFETCH_RAW): Fetch multibyte char if applicable.
(PATUNFETCH): Remove.
(regex_compile): Rely on PATFETCH to do most of the multibyte magic.
When writing a char, write it directly into the pattern buffer rather
than going needlessly through a temp char-array.
(re_match_2_internal): Similarly, rely on RE_STRING_CHAR to do the
multibyte magic and remove the useless `#ifdef emacs'.
(bcmp_translate): Don't compare as multibyte chars when in a unibyte
buffer.
* regex.h (struct re_pattern_buffer): Make field `multibyte'
conditional on `emacs'.
* charset.h (GET_CHAR_BEFORE_2): Moved to regex.c.
parent 09654086
No preview for this file type
......@@ -577,18 +577,6 @@ else
? 1 \
: multibyte_form_length (str, len))
/* Set C a (possibly multibyte) character before P. P points into a
string which is the virtual concatenation of STR1 (which ends at
END1) or STR2 (which ends at END2). */
#define GET_CHAR_BEFORE_2(c, p, str1, end1, str2, end2) \
do { \
const unsigned char *dtemp = (p); \
const unsigned char *dlimit = ((p) > (str2) && (p) <= (end2)) ? (str2) : (str1); \
while (dtemp-- > dlimit && *dtemp >= 0xA0); \
c = STRING_CHAR (dtemp, p - dtemp); \
} while (0)
#ifdef emacs
/* Increase the buffer byte position POS_BYTE of the current buffer to
......
This diff is collapsed.
......@@ -362,9 +362,11 @@ struct re_pattern_buffer
/* If true, an anchor at a newline matches. */
unsigned newline_anchor : 1;
#ifdef emacs
/* If true, multi-byte form in the `buffer' should be recognized as a
multibyte character. */
unsigned multibyte : 1;
#endif
/* [[[end pattern_buffer]]] */
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment