diff options
Diffstat (limited to 'src/include/regex')
-rw-r--r-- | src/include/regex/regerrs.h | 2 | ||||
-rw-r--r-- | src/include/regex/regex.h | 2 | ||||
-rw-r--r-- | src/include/regex/regguts.h | 15 |
3 files changed, 11 insertions, 8 deletions
diff --git a/src/include/regex/regerrs.h b/src/include/regex/regerrs.h index 809b5112660..41e25f7ff00 100644 --- a/src/include/regex/regerrs.h +++ b/src/include/regex/regerrs.h @@ -75,7 +75,7 @@ }, { - REG_ETOOBIG, "REG_ETOOBIG", "nfa has too many states" + REG_ETOOBIG, "REG_ETOOBIG", "regular expression is too complex" }, { diff --git a/src/include/regex/regex.h b/src/include/regex/regex.h index 3020b0ff0f7..5e1b692d26c 100644 --- a/src/include/regex/regex.h +++ b/src/include/regex/regex.h @@ -152,7 +152,7 @@ typedef struct #define REG_INVARG 16 /* invalid argument to regex function */ #define REG_MIXED 17 /* character widths of regex and string differ */ #define REG_BADOPT 18 /* invalid embedded option */ -#define REG_ETOOBIG 19 /* nfa has too many states */ +#define REG_ETOOBIG 19 /* regular expression is too complex */ #define REG_ECOLORS 20 /* too many colors */ #define REG_CANCEL 21 /* operation cancelled */ /* two specials for debugging and testing */ diff --git a/src/include/regex/regguts.h b/src/include/regex/regguts.h index 357891aa254..19fe991c74f 100644 --- a/src/include/regex/regguts.h +++ b/src/include/regex/regguts.h @@ -334,9 +334,6 @@ struct nfa struct colormap *cm; /* the color map */ color bos[2]; /* colors, if any, assigned to BOS and BOL */ color eos[2]; /* colors, if any, assigned to EOS and EOL */ - size_t size; /* Current NFA size; differs from nstates as - * it also counts the number of states in - * children of this NFA. */ struct vars *v; /* simplifies compile error reporting */ struct nfa *parent; /* parent NFA, if any */ }; @@ -384,10 +381,16 @@ struct cnfa #define NULLCNFA(cnfa) ((cnfa).nstates == 0) /* - * Used to limit the maximum NFA size to something sane. [Tcl Bug 1810264] + * This symbol limits the transient heap space used by the regex compiler, + * and thereby also the maximum complexity of NFAs that we'll deal with. + * Currently we only count NFA states and arcs against this; the other + * transient data is generally not large enough to notice compared to those. + * Note that we do not charge anything for the final output data structures + * (the compacted NFA and the colormap). */ -#ifndef REG_MAX_STATES -#define REG_MAX_STATES 100000 +#ifndef REG_MAX_COMPILE_SPACE +#define REG_MAX_COMPILE_SPACE \ + (100000 * sizeof(struct state) + 100000 * sizeof(struct arcbatch)) #endif /* |