diff options
| author | Karl Heuer | 1994-04-21 19:26:10 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-04-21 19:26:10 +0000 |
| commit | 501b568d67a5b6abfd93e8fe8ae7bd90bd053571 (patch) | |
| tree | 57a93535e0d49692f09efb0d58b8dd8d845e0711 /src | |
| parent | 19b8fb9d760b207d7fbcca78747b136cc7646195 (diff) | |
| download | emacs-501b568d67a5b6abfd93e8fe8ae7bd90bd053571.tar.gz emacs-501b568d67a5b6abfd93e8fe8ae7bd90bd053571.zip | |
*** empty log message ***
Diffstat (limited to 'src')
| -rw-r--r-- | src/regex.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/regex.c b/src/regex.c index 4513cb10298..8cabea721b4 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -888,7 +888,7 @@ static const char *re_error_msg[] = | |||
| 888 | 888 | ||
| 889 | /* Avoiding alloca during matching, to placate r_alloc. */ | 889 | /* Avoiding alloca during matching, to placate r_alloc. */ |
| 890 | 890 | ||
| 891 | /* Define MATCH_MAY_ALLOCATE if we need to make sure that the | 891 | /* Define MATCH_MAY_ALLOCATE unless we need to make sure that the |
| 892 | searching and matching functions should not call alloca. On some | 892 | searching and matching functions should not call alloca. On some |
| 893 | systems, alloca is implemented in terms of malloc, and if we're | 893 | systems, alloca is implemented in terms of malloc, and if we're |
| 894 | using the relocating allocator routines, then malloc could cause a | 894 | using the relocating allocator routines, then malloc could cause a |
| @@ -1256,6 +1256,7 @@ typedef union | |||
| 1256 | We make the fail stack a global thing, and then grow it to | 1256 | We make the fail stack a global thing, and then grow it to |
| 1257 | re_max_failures when we compile. */ | 1257 | re_max_failures when we compile. */ |
| 1258 | #ifndef MATCH_MAY_ALLOCATE | 1258 | #ifndef MATCH_MAY_ALLOCATE |
| 1259 | static int fail_stack_allocated; | ||
| 1259 | static fail_stack_type fail_stack; | 1260 | static fail_stack_type fail_stack; |
| 1260 | 1261 | ||
| 1261 | static const char ** regstart, ** regend; | 1262 | static const char ** regstart, ** regend; |
| @@ -2493,10 +2494,19 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 2493 | is strictly greater than re_max_failures, the largest possible stack | 2494 | is strictly greater than re_max_failures, the largest possible stack |
| 2494 | is 2 * re_max_failures failure points. */ | 2495 | is 2 * re_max_failures failure points. */ |
| 2495 | fail_stack.size = (2 * re_max_failures * MAX_FAILURE_ITEMS); | 2496 | fail_stack.size = (2 * re_max_failures * MAX_FAILURE_ITEMS); |
| 2496 | if (! fail_stack.stack) | 2497 | if (fail_stack.size > fail_stack_allocated) |
| 2497 | fail_stack.stack = | 2498 | { |
| 2498 | (fail_stack_elt_t *) malloc (fail_stack.size | 2499 | if (! fail_stack.stack) |
| 2499 | * sizeof (fail_stack_elt_t)); | 2500 | fail_stack.stack = |
| 2501 | (fail_stack_elt_t *) malloc (fail_stack.size | ||
| 2502 | * sizeof (fail_stack_elt_t)); | ||
| 2503 | else | ||
| 2504 | fail_stack.stack = | ||
| 2505 | (fail_stack_elt_t *) realloc (fail_stack.stack, | ||
| 2506 | (fail_stack.size | ||
| 2507 | * sizeof (fail_stack_elt_t))); | ||
| 2508 | fail_stack_allocated = fail_stack.size; | ||
| 2509 | } | ||
| 2500 | 2510 | ||
| 2501 | /* Initialize some other variables the matcher uses. */ | 2511 | /* Initialize some other variables the matcher uses. */ |
| 2502 | RETALLOC_IF (regstart, num_regs, const char *); | 2512 | RETALLOC_IF (regstart, num_regs, const char *); |