Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
501b568d
Commit
501b568d
authored
Apr 21, 1994
by
Karl Heuer
Browse files
*** empty log message ***
parent
19b8fb9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
src/regex.c
src/regex.c
+15
-5
No files found.
src/regex.c
View file @
501b568d
...
...
@@ -888,7 +888,7 @@ static const char *re_error_msg[] =
/* Avoiding alloca during matching, to placate r_alloc. */
/* Define MATCH_MAY_ALLOCATE
if
we need to make sure that the
/* Define MATCH_MAY_ALLOCATE
unless
we need to make sure that the
searching and matching functions should not call alloca. On some
systems, alloca is implemented in terms of malloc, and if we're
using the relocating allocator routines, then malloc could cause a
...
...
@@ -1256,6 +1256,7 @@ typedef union
We make the fail stack a global thing, and then grow it to
re_max_failures when we compile. */
#ifndef MATCH_MAY_ALLOCATE
static
int
fail_stack_allocated
;
static
fail_stack_type
fail_stack
;
static
const
char
**
regstart
,
**
regend
;
...
...
@@ -2493,10 +2494,19 @@ regex_compile (pattern, size, syntax, bufp)
is strictly greater than re_max_failures, the largest possible stack
is 2 * re_max_failures failure points. */
fail_stack
.
size
=
(
2
*
re_max_failures
*
MAX_FAILURE_ITEMS
);
if
(
!
fail_stack
.
stack
)
fail_stack
.
stack
=
(
fail_stack_elt_t
*
)
malloc
(
fail_stack
.
size
*
sizeof
(
fail_stack_elt_t
));
if
(
fail_stack
.
size
>
fail_stack_allocated
)
{
if
(
!
fail_stack
.
stack
)
fail_stack
.
stack
=
(
fail_stack_elt_t
*
)
malloc
(
fail_stack
.
size
*
sizeof
(
fail_stack_elt_t
));
else
fail_stack
.
stack
=
(
fail_stack_elt_t
*
)
realloc
(
fail_stack
.
stack
,
(
fail_stack
.
size
*
sizeof
(
fail_stack_elt_t
)));
fail_stack_allocated
=
fail_stack
.
size
;
}
/* Initialize some other variables the matcher uses. */
RETALLOC_IF
(
regstart
,
num_regs
,
const
char
*
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment