-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2004-11-12 Ulrich Drepper <drepper@redhat.com> * posix/Makefile (tests): Add bug-regex24. * posix/bug-regex24.c: New file. 2004-11-12 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (check_dst_limits_calc_pos_1): Use the map to cut recursive paths. Make exit condition more precise. (match_ctx_add_entry): Initialize the map. * posix/regex_internal.h (struct re_backref_cache_entry): Add a map of reachable subexpression nodes from each backreference cache entry.
- Loading branch information
Ulrich Drepper
committed
Nov 12, 2004
1 parent
ccd8de9
commit 7db6120
Showing
5 changed files
with
99 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#include <regex.h> | ||
#include <stdio.h> | ||
|
||
#define str "civic" | ||
|
||
#define N 10 | ||
static const char *expected[N] = | ||
{ | ||
str, "c", "i", "", "", "", "", "", "", "" | ||
}; | ||
|
||
static int | ||
do_test (void) | ||
{ | ||
regex_t rbuf; | ||
static const char pat[] = "\ | ||
^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$"; | ||
|
||
int err = regcomp (&rbuf, pat, REG_EXTENDED); | ||
if (err != 0) | ||
{ | ||
char errstr[300]; | ||
regerror (err, &rbuf, errstr, sizeof (errstr)); | ||
puts (errstr); | ||
return err; | ||
} | ||
|
||
regmatch_t m[N]; | ||
err = regexec (&rbuf, str, N, m, 0); | ||
if (err != 0) | ||
{ | ||
puts ("regexec failed"); | ||
return 1; | ||
} | ||
|
||
int result = 0; | ||
for (int i = 0; i < N; ++i) | ||
if (m[i].rm_so == -1) | ||
{ | ||
printf ("m[%d] unused\n", i); | ||
result = 1; | ||
} | ||
else | ||
{ | ||
int len = m[i].rm_eo - m[i].rm_so; | ||
|
||
printf ("m[%d] = \"%.*s\"\n", i, len, str + m[i].rm_so); | ||
|
||
if (strlen (expected[i]) != len | ||
|| memcmp (expected[i], str + m[i].rm_so, len) != 0) | ||
result = 1; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
#define TIMEOUT 30 | ||
#define TEST_FUNCTION do_test () | ||
#include "../test-skeleton.c" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters