diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 1998-10-20 12:49:18 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 1998-10-20 12:49:18 +0000 |
commit | 1568b2614a9addf74d0632f2beaaafc6127a2d20 (patch) | |
tree | 050ec6eb6088a8d81390cf51f34531fb78f0eb90 /otherlibs/str/regex-0.12/regex.c | |
parent | dcc7f0d600cb0f6d3c5b68a5378c5aaf74650758 (diff) |
Patches de Ian Zimmerman (string_partial_match, etc)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2127 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/str/regex-0.12/regex.c')
-rw-r--r-- | otherlibs/str/regex-0.12/regex.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/otherlibs/str/regex-0.12/regex.c b/otherlibs/str/regex-0.12/regex.c index 3f4ff815f..3798992d8 100644 --- a/otherlibs/str/regex-0.12/regex.c +++ b/otherlibs/str/regex-0.12/regex.c @@ -2261,7 +2261,9 @@ compile_range (p_ptr, pend, translate, syntax, b) exactly that if always used MAX_FAILURE_SPACE each time we failed. This is a variable only so users of regex can assign to it; we never change it ourselves. */ -int re_max_failures = 2000; +/* Xavier Leroy 14/10/1998: bumped from 2000 to 8000 because 2000 + causes failures even with relatively simple patterns */ +int re_max_failures = 8000; typedef const unsigned char *fail_stack_elt_t; @@ -3065,12 +3067,14 @@ typedef union /* Call before fetching a character with *d. This switches over to string2 if necessary. */ +/* itz Mon Sep 21 19:31:55 PDT 1998 set a flag in case we're at the + end, to indicate a partial match was possible. */ #define PREFETCH() \ while (d == dend) \ { \ /* End of string2 => fail. */ \ if (dend == end_match_2) \ - goto fail; \ + { partial = 1; goto fail; } \ /* End of string1 => advance to string2. */ \ d = string2; \ dend = end_match_2; \ @@ -3260,6 +3264,9 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) const char **reg_dummy; register_info_type *reg_info_dummy; + /* itz Mon Sep 21 19:34:09 PDT 1998 record a partial match here */ + int partial = 0; + #ifdef DEBUG /* Counts the total number of registers pushed. */ unsigned num_regs_pushed = 0; @@ -4341,7 +4348,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) FREE_VARIABLES (); - return -1; /* Failure to match. */ + return (partial ? -3 : -1); /* Failure to match. */ } /* re_match_2 */ /* Subroutine definitions for re_match_2. */ |