summaryrefslogtreecommitdiff
path: root/src/regex.c
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1998-11-10 07:03:05 +0000
committerKarl Heuer <kwzh@gnu.org>1998-11-10 07:03:05 +0000
commit3583e969a48791902885423e6c519df329bcebc8 (patch)
tree369b8aae510e6cd8d33209f6986082e440dba7f0 /src/regex.c
parentc61bca6a2858108256801abf8f87caaa3cee1116 (diff)
downloademacs-3583e969a48791902885423e6c519df329bcebc8.tar.gz
(regex_compile): Handle translation of multibyte
exact-match characters.
Diffstat (limited to 'src/regex.c')
-rw-r--r--src/regex.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/regex.c b/src/regex.c
index cf89000df11..0dcdedec517 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -2903,8 +2903,12 @@ regex_compile (pattern, size, syntax, bufp)
p1 = p - 1; /* P1 points the head of C. */
#ifdef emacs
if (bufp->multibyte)
- /* Set P to the next character boundary. */
- p += MULTIBYTE_FORM_LENGTH (p1, pend - p1) - 1;
+ {
+ c = STRING_CHAR (p1, pend - p1);
+ c = TRANSLATE (c);
+ /* Set P to the next character boundary. */
+ p += MULTIBYTE_FORM_LENGTH (p1, pend - p1) - 1;
+ }
#endif
/* If no exactn currently being built. */
if (!pending_exact
@@ -2933,16 +2937,23 @@ regex_compile (pattern, size, syntax, bufp)
pending_exact = b - 1;
}
- /* Here, C may translated, therefore C may not equal to *P1. */
- while (1)
+#ifdef emacs
+ if (! SINGLE_BYTE_CHAR_P (c))
+ {
+ unsigned char work[4], *str;
+ int i = CHAR_STRING (c, work, str);
+ int j;
+ for (j = 0; j < i; j++)
+ {
+ BUF_PUSH (str[j]);
+ (*pending_exact)++;
+ }
+ }
+ else
+#endif
{
BUF_PUSH (c);
(*pending_exact)++;
- if (++p1 == p)
- break;
-
- /* Rest of multibyte form should be copied literally. */
- c = *(unsigned char *)p1;
}
break;
} /* switch (c) */