comparison src/regex.c @ 8561:dc5353720725

(regex_compile): Split an if to avoid compiler bug. (re_match_2_internal): Use separate if to compute bestmatch_p.
author Richard M. Stallman <rms@gnu.org>
date Wed, 17 Aug 1994 23:13:50 +0000
parents f1a7929cee65
children 35bc87e0b41c
comparison
equal deleted inserted replaced
8560:42b300c5ac5d 8561:dc5353720725
1920 1920
1921 if (p == pend) FREE_STACK_RETURN (REG_EBRACK); 1921 if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
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 }
1941 else 1945 else
1942 { 1946 {
3600 /* 1 if this match ends in the same string (string1 or string2) 3604 /* 1 if this match ends in the same string (string1 or string2)
3601 as the best previous match. */ 3605 as the best previous match. */
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
3610 if (!FAIL_STACK_EMPTY ()) 3620 if (!FAIL_STACK_EMPTY ())
3611 { /* More failure points to try. */ 3621 { /* More failure points to try. */