aboutsummaryrefslogtreecommitdiffstats
path: root/src/regex.c
diff options
context:
space:
mode:
authorRichard M. Stallman1994-08-17 23:13:50 +0000
committerRichard M. Stallman1994-08-17 23:13:50 +0000
commit514b8dcfdbf66a2953fb0994bb1ca964d964ecb3 (patch)
tree91d11b745d4befe1a7d93e4e3ab485c17056af5e /src/regex.c
parent5db82c9d72cd3242233ea88797dd24c8b460fb4d (diff)
downloademacs-514b8dcfdbf66a2953fb0994bb1ca964d964ecb3.tar.gz
emacs-514b8dcfdbf66a2953fb0994bb1ca964d964ecb3.zip
(regex_compile): Split an if to avoid compiler bug.
(re_match_2_internal): Use separate if to compute bestmatch_p.
Diffstat (limited to 'src/regex.c')
-rw-r--r--src/regex.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/regex.c b/src/regex.c
index 82ab3d0873c..87c3e63edfd 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -1922,19 +1922,23 @@ regex_compile (pattern, size, syntax, bufp)
1922 1922
1923 for (ch = 0; ch < 1 << BYTEWIDTH; ch++) 1923 for (ch = 0; ch < 1 << BYTEWIDTH; ch++)
1924 { 1924 {
1925 /* This was split into 3 if's to
1926 avoid an arbitrary limit in some compiler. */
1925 if ( (is_alnum && ISALNUM (ch)) 1927 if ( (is_alnum && ISALNUM (ch))
1926 || (is_alpha && ISALPHA (ch)) 1928 || (is_alpha && ISALPHA (ch))
1927 || (is_blank && ISBLANK (ch)) 1929 || (is_blank && ISBLANK (ch))
1928 || (is_cntrl && ISCNTRL (ch)) 1930 || (is_cntrl && ISCNTRL (ch)))
1929 || (is_digit && ISDIGIT (ch)) 1931 SET_LIST_BIT (ch);
1932 if ( (is_digit && ISDIGIT (ch))
1930 || (is_graph && ISGRAPH (ch)) 1933 || (is_graph && ISGRAPH (ch))
1931 || (is_lower && ISLOWER (ch)) 1934 || (is_lower && ISLOWER (ch))
1932 || (is_print && ISPRINT (ch)) 1935 || (is_print && ISPRINT (ch)))
1933 || (is_punct && ISPUNCT (ch)) 1936 SET_LIST_BIT (ch);
1937 if ( (is_punct && ISPUNCT (ch))
1934 || (is_space && ISSPACE (ch)) 1938 || (is_space && ISSPACE (ch))
1935 || (is_upper && ISUPPER (ch)) 1939 || (is_upper && ISUPPER (ch))
1936 || (is_xdigit && ISXDIGIT (ch))) 1940 || (is_xdigit && ISXDIGIT (ch)))
1937 SET_LIST_BIT (ch); 1941 SET_LIST_BIT (ch);
1938 } 1942 }
1939 had_char_class = true; 1943 had_char_class = true;
1940 } 1944 }
@@ -3602,8 +3606,14 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
3602 boolean same_str_p = (FIRST_STRING_P (match_end) 3606 boolean same_str_p = (FIRST_STRING_P (match_end)
3603 == MATCHING_IN_FIRST_STRING); 3607 == MATCHING_IN_FIRST_STRING);
3604 /* 1 if this match is the best seen so far. */ 3608 /* 1 if this match is the best seen so far. */
3605 boolean best_match_p = (same_str_p ? d > match_end 3609 boolean best_match_p;
3606 : !MATCHING_IN_FIRST_STRING); 3610
3611 /* AIX compiler got confused when this was combined
3612 with the previous declaration. */
3613 if (same_str_p)
3614 best_match_p = d > match_end;
3615 else
3616 best_match_p = !MATCHING_IN_FIRST_STRING;
3607 3617
3608 DEBUG_PRINT1 ("backtracking.\n"); 3618 DEBUG_PRINT1 ("backtracking.\n");
3609 3619