From: Kenichi Handa Date: Fri, 11 Aug 2000 01:56:59 +0000 (+0000) Subject: (regex_compile) : Pay attention to multibyteness. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef7682a4f97026900379ed9b09c7d27e799b7501;p=pspp (regex_compile) : Pay attention to multibyteness. (analyse_first) : Setup fastmap correctly for eight-bit-control characters. --- diff --git a/regex.c b/regex.c index 1b796c0888..97cc409b54 100644 --- a/regex.c +++ b/regex.c @@ -3064,7 +3064,12 @@ regex_compile (pattern, size, syntax, bufp) GET_BUFFER_SPACE (MAX_MULTIBYTE_LENGTH); { - int len = CHAR_STRING (c, b); + int len; + + if (multibyte) + len = CHAR_STRING (c, b); + else + *b = c, len = 1; b += len; (*pending_exact) += len; } @@ -3375,7 +3380,15 @@ analyse_first (p, pend, fastmap, multibyte) with `break'. */ case exactn: - if (fastmap) fastmap[p[1]] = 1; + if (fastmap) + { + int c = RE_STRING_CHAR (p + 1, pend - p); + + if (SINGLE_BYTE_CHAR_P (c)) + fastmap[c] = 1; + else + fastmap[p[1]] = 1; + } break;