From ea7e240a634e28b0a96db0216dd4effb0affcd24 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Fri, 1 Nov 2013 22:49:42 +0000 Subject: [PATCH 1/2] Added failing test --- slre.c | 1 + 1 file changed, 1 insertion(+) diff --git a/slre.c b/slre.c index 0060513..d0827f8 100644 --- a/slre.c +++ b/slre.c @@ -580,6 +580,7 @@ int main(void) { SLRE_CAPS_ARRAY_TOO_SMALL); ASSERT(slre_match("(.+/\\d+\\.\\d+)\\.jpg$", "/foo/bar/12.34.jpg", 18, caps, 1) == 18); + ASSERT(slre_match("(ab|cd).*\\.(xx|yy)", "ab.yy", 5, NULL, 0) == 5); /* Greedy vs non-greedy */ ASSERT(slre_match(".+c", "abcabc", 6, NULL, 0) == 6); From 1badac6c63b1da8c31cf7716c8c1beddf724e59f Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Mon, 4 Nov 2013 14:38:49 +0000 Subject: [PATCH 2/2] Removed unused variable --- slre.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/slre.c b/slre.c index d0827f8..2e5ece8 100644 --- a/slre.c +++ b/slre.c @@ -345,9 +345,6 @@ static void setup_branch_points(struct regex_info *info) { static int foo(const char *re, int re_len, const char *s, int s_len, struct regex_info *info) { int i, step, depth = 0; - const char *stack[ARRAY_SIZE(info->brackets)]; - - stack[0] = re; /* First bracket captures everything */ info->brackets[0].ptr = re; @@ -382,7 +379,6 @@ static int foo(const char *re, int re_len, const char *s, int s_len, FAIL_IF(info->num_brackets >= ARRAY_SIZE(info->brackets), SLRE_TOO_MANY_BRACKETS); depth++; /* Order is important here. Depth increments first. */ - stack[depth] = &re[i]; info->brackets[info->num_brackets].ptr = re + i + 1; info->brackets[info->num_brackets].len = -1; info->num_brackets++;