diff options
| author | Richard M. Stallman | 2003-10-13 18:48:14 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-10-13 18:48:14 +0000 |
| commit | 275a34095ac44a4c2febe033875190558d3e5ff0 (patch) | |
| tree | 24a4b03981d28943297d2289f3e5123d3b60eb85 /src | |
| parent | 4532fdde327e5e9b45735e8fe8e44d2601cb2dcc (diff) | |
| download | emacs-275a34095ac44a4c2febe033875190558d3e5ff0.tar.gz emacs-275a34095ac44a4c2febe033875190558d3e5ff0.zip | |
(MAX_BUF_SIZE): Reduce to 2**15.
(print_partial_compiled_pattern): Replace assert with a printout.
(skip_noops, mutually_exclusive_p): Change args, values to re_char *.
Diffstat (limited to 'src')
| -rw-r--r-- | src/regex.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/regex.c b/src/regex.c index a57ae00d14f..a145183510d 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -975,9 +975,10 @@ print_partial_compiled_pattern (start, end) | |||
| 975 | int has_range_table = CHARSET_RANGE_TABLE_EXISTS_P (p - 1); | 975 | int has_range_table = CHARSET_RANGE_TABLE_EXISTS_P (p - 1); |
| 976 | 976 | ||
| 977 | fprintf (stderr, "/charset [%s", | 977 | fprintf (stderr, "/charset [%s", |
| 978 | (re_opcode_t) *(p - 1) == charset_not ? "^" : ""); | 978 | (re_opcode_t) *(p - 1) == charset_not ? "^" : ""); |
| 979 | 979 | ||
| 980 | assert (p + *p < pend); | 980 | if (p + *p >= pend) |
| 981 | fprintf (stderr, " !extends past end of pattern! "); | ||
| 981 | 982 | ||
| 982 | for (c = 0; c < 256; c++) | 983 | for (c = 0; c < 256; c++) |
| 983 | if (c / 8 < length | 984 | if (c / 8 < length |
| @@ -1736,8 +1737,11 @@ static int analyse_first _RE_ARGS ((re_char *p, re_char *pend, | |||
| 1736 | 1737 | ||
| 1737 | 1738 | ||
| 1738 | /* This is not an arbitrary limit: the arguments which represent offsets | 1739 | /* This is not an arbitrary limit: the arguments which represent offsets |
| 1739 | into the pattern are two bytes long. So if 2^16 bytes turns out to | 1740 | into the pattern are two bytes long. So if 2^15 bytes turns out to |
| 1740 | be too small, many things would have to change. */ | 1741 | be too small, many things would have to change. */ |
| 1742 | # define MAX_BUF_SIZE (1L << 15) | ||
| 1743 | |||
| 1744 | #if 0 /* This is when we thought it could be 2^16 bytes. */ | ||
| 1741 | /* Any other compiler which, like MSC, has allocation limit below 2^16 | 1745 | /* Any other compiler which, like MSC, has allocation limit below 2^16 |
| 1742 | bytes will have to use approach similar to what was done below for | 1746 | bytes will have to use approach similar to what was done below for |
| 1743 | MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up | 1747 | MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up |
| @@ -1749,6 +1753,7 @@ static int analyse_first _RE_ARGS ((re_char *p, re_char *pend, | |||
| 1749 | #else | 1753 | #else |
| 1750 | # define MAX_BUF_SIZE (1L << 16) | 1754 | # define MAX_BUF_SIZE (1L << 16) |
| 1751 | #endif | 1755 | #endif |
| 1756 | #endif /* 0 */ | ||
| 1752 | 1757 | ||
| 1753 | /* Extend the buffer by twice its current size via realloc and | 1758 | /* Extend the buffer by twice its current size via realloc and |
| 1754 | reset the pointers that pointed into the old block to point to the | 1759 | reset the pointers that pointed into the old block to point to the |
| @@ -4456,9 +4461,9 @@ skip_one_char (p) | |||
| 4456 | 4461 | ||
| 4457 | 4462 | ||
| 4458 | /* Jump over non-matching operations. */ | 4463 | /* Jump over non-matching operations. */ |
| 4459 | static unsigned char * | 4464 | static re_char * |
| 4460 | skip_noops (p, pend) | 4465 | skip_noops (p, pend) |
| 4461 | unsigned char *p, *pend; | 4466 | re_char *p, *pend; |
| 4462 | { | 4467 | { |
| 4463 | int mcnt; | 4468 | int mcnt; |
| 4464 | while (p < pend) | 4469 | while (p < pend) |
| @@ -4487,7 +4492,7 @@ skip_noops (p, pend) | |||
| 4487 | static int | 4492 | static int |
| 4488 | mutually_exclusive_p (bufp, p1, p2) | 4493 | mutually_exclusive_p (bufp, p1, p2) |
| 4489 | struct re_pattern_buffer *bufp; | 4494 | struct re_pattern_buffer *bufp; |
| 4490 | unsigned char *p1, *p2; | 4495 | re_char *p1, *p2; |
| 4491 | { | 4496 | { |
| 4492 | re_opcode_t op2; | 4497 | re_opcode_t op2; |
| 4493 | const boolean multibyte = RE_MULTIBYTE_P (bufp); | 4498 | const boolean multibyte = RE_MULTIBYTE_P (bufp); |