diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-11-25 22:32:18 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-11-25 22:32:18 +0000 |
commit | 20dc2f79f7626201b14bb706688bb2171c7cb59c (patch) | |
tree | c12fa685b1064398ce06cc7231f36dda02fe3c82 /posix/regex_internal.c | |
parent | fda81cf586c87af042fc31bda774689c14c0cec4 (diff) | |
download | glibc-20dc2f79f7626201b14bb706688bb2171c7cb59c.tar.gz |
Update.
2004-11-23 Paolo Bonzini <bonzini@gnu.org>
* posix/regcomp.c (analyze_tree): Always call calc_epsdest.
(calc_inveclosure): Use re_node_set_insert_last.
(parse_dup_op): Lower X{1,5} to (X(X(X(XX?)?)?)?)?
rather than X?X?X?X?X?.
* posix/regex_internal.h (re_node_set_insert_last): New declaration.
* posix/regex_internal.c (re_node_set_insert_last): New function.
* posix/PCRE.tests: Add testcases.
Diffstat (limited to 'posix/regex_internal.c')
-rw-r--r-- | posix/regex_internal.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/posix/regex_internal.c b/posix/regex_internal.c index bb1d73d9a0..cb439e5d7c 100644 --- a/posix/regex_internal.c +++ b/posix/regex_internal.c @@ -1250,6 +1250,31 @@ re_node_set_insert (set, elem) return 1; } +/* Insert the new element ELEM to the re_node_set* SET. + SET should not already have any element greater than or equal to ELEM. + Return -1 if an error is occured, return 1 otherwise. */ + +static int +re_node_set_insert_last (set, elem) + re_node_set *set; + int elem; +{ + /* Realloc if we need. */ + if (set->alloc == set->nelem) + { + int *new_array; + set->alloc = (set->alloc + 1) * 2; + new_array = re_realloc (set->elems, int, set->alloc); + if (BE (new_array == NULL, 0)) + return -1; + set->elems = new_array; + } + + /* Insert the new element. */ + set->elems[set->nelem++] = elem; + return 1; +} + /* Compare two node sets SET1 and SET2. return 1 if SET1 and SET2 are equivalent, return 0 otherwise. */ |