@@ -2000,7 +2000,6 @@ re_compile_pattern(pattern, size, bufp)
2000
2000
2001
2001
/* set optimize flags */
2002
2002
laststart = bufp -> buffer ;
2003
- if (* laststart == exactn ) bufp -> options |= RE_OPTIMIZE_EXACTN ;
2004
2003
if (* laststart == start_memory ) laststart += 3 ;
2005
2004
if (* laststart == dummy_failure_jump ) laststart += 3 ;
2006
2005
else if (* laststart == try_next ) laststart += 3 ;
@@ -2025,18 +2024,25 @@ re_compile_pattern(pattern, size, bufp)
2025
2024
2026
2025
bufp -> used = b - bufp -> buffer ;
2027
2026
bufp -> re_nsub = regnum ;
2028
- bufp -> must = calculate_must_string (bufp -> buffer , b );
2029
- if (current_mbctype ) bufp -> options |= RE_OPTIMIZE_NO_BM ;
2027
+ if (* bufp -> buffer == exactn ) {
2028
+ bufp -> options |= RE_OPTIMIZE_EXACTN ;
2029
+ bufp -> must = bufp -> buffer + 1 ;
2030
+ }
2031
+ else {
2032
+ bufp -> must = calculate_must_string (bufp -> buffer , b );
2033
+ }
2034
+ if (current_mbctype == MBCTYPE_SJIS ) bufp -> options |= RE_OPTIMIZE_NO_BM ;
2030
2035
else if (bufp -> must ) {
2031
- int i ;
2032
- int len = (( unsigned char )bufp -> must [0 ]) ;
2036
+ int i ;
2037
+ int len = (unsigned char )bufp -> must [0 ];
2033
2038
2034
- for (i = 1 ; i < len ; i ++ ) {
2035
- if ((unsigned char )bufp -> must [i ] == 0xff ) {
2036
- bufp -> options |= RE_OPTIMIZE_NO_BM ;
2037
- break ;
2038
- }
2039
+ for (i = 1 ; i < len ; i ++ ) {
2040
+ if ((unsigned char )bufp -> must [i ] == 0xff ||
2041
+ ( current_mbctype == MBCTYPE_EUC && ismbchar ( bufp -> must [ i ]))) {
2042
+ bufp -> options |= RE_OPTIMIZE_NO_BM ;
2043
+ break ;
2039
2044
}
2045
+ }
2040
2046
}
2041
2047
2042
2048
FREE_AND_RETURN (stackb , 0 );
0 commit comments