diff options
| author | Richard M. Stallman | 1995-05-15 23:30:28 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-05-15 23:30:28 +0000 |
| commit | 4e9ffb56abc9f3793c463c599fdf11d15c4edbf3 (patch) | |
| tree | 72bf24308a9432ffc5eb46789890f09e4220b746 | |
| parent | a8fd2a74cba1af6802d6196f1bcd9e5c1e701135 (diff) | |
| download | emacs-4e9ffb56abc9f3793c463c599fdf11d15c4edbf3.tar.gz emacs-4e9ffb56abc9f3793c463c599fdf11d15c4edbf3.zip | |
(re_compile_fastmap): Don't free stack if it's empty.
(re_match_failures): Reduce the larger value to 200000,
and use whenever if MATCH_MAY_ALLOCATE.
(MATCH_MAY_ALLOCATE): Don't consider REL_ALLOC when deciding
whether to undef this.
| -rw-r--r-- | src/regex.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/regex.c b/src/regex.c index 3c0392a59a0..74fca1cbbae 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -960,8 +960,11 @@ static const char *re_error_msgid[] = | |||
| 960 | #endif | 960 | #endif |
| 961 | 961 | ||
| 962 | /* The match routines may not allocate if (1) they would do it with malloc | 962 | /* The match routines may not allocate if (1) they would do it with malloc |
| 963 | and (2) it's not safe for them to use malloc. */ | 963 | and (2) it's not safe for them to use malloc. |
| 964 | #if (defined (C_ALLOCA) || defined (REGEX_MALLOC)) && (defined (emacs) || defined (REL_ALLOC)) | 964 | Note that if REL_ALLOC is defined, matching would not use malloc for the |
| 965 | failure stack, but we would still use it for the register vectors; | ||
| 966 | so REL_ALLOC should not affect this. */ | ||
| 967 | #if (defined (C_ALLOCA) || defined (REGEX_MALLOC)) && defined (emacs) | ||
| 965 | #undef MATCH_MAY_ALLOCATE | 968 | #undef MATCH_MAY_ALLOCATE |
| 966 | #endif | 969 | #endif |
| 967 | 970 | ||
| @@ -982,8 +985,8 @@ static const char *re_error_msgid[] = | |||
| 982 | exactly that if always used MAX_FAILURE_SPACE each time we failed. | 985 | exactly that if always used MAX_FAILURE_SPACE each time we failed. |
| 983 | This is a variable only so users of regex can assign to it; we never | 986 | This is a variable only so users of regex can assign to it; we never |
| 984 | change it ourselves. */ | 987 | change it ourselves. */ |
| 985 | #ifdef REL_ALLOC | 988 | #if defined (MATCH_MAY_ALLOCATE) |
| 986 | int re_max_failures = 20000000; | 989 | int re_max_failures = 200000; |
| 987 | #else | 990 | #else |
| 988 | int re_max_failures = 2000; | 991 | int re_max_failures = 2000; |
| 989 | #endif | 992 | #endif |
| @@ -3138,7 +3141,8 @@ re_compile_fastmap (bufp) | |||
| 3138 | bufp->can_be_null |= path_can_be_null; | 3141 | bufp->can_be_null |= path_can_be_null; |
| 3139 | 3142 | ||
| 3140 | done: | 3143 | done: |
| 3141 | REGEX_FREE_STACK (fail_stack.stack); | 3144 | if (!FAIL_STACK_EMPTY ()) |
| 3145 | REGEX_FREE_STACK (fail_stack.stack); | ||
| 3142 | return 0; | 3146 | return 0; |
| 3143 | } /* re_compile_fastmap */ | 3147 | } /* re_compile_fastmap */ |
| 3144 | 3148 | ||