summaryrefslogtreecommitdiffstats
path: root/regexec.c
diff options
context:
space:
mode:
authorksaito <ksaito@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-27 16:04:30 +0000
committerksaito <ksaito@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-27 16:04:30 +0000
commitc016a516bfac8ebb1d80e050a25e6e1dd8571831 (patch)
tree4d286c8e9cfe421792eea657e5c78e385e537420 /regexec.c
parentf79e25aadf4d1908cf7e7ae5d7ddced7f91bb724 (diff)
downloadruby-c016a516bfac8ebb1d80e050a25e6e1dd8571831.tar.gz
ruby-c016a516bfac8ebb1d80e050a25e6e1dd8571831.tar.xz
ruby-c016a516bfac8ebb1d80e050a25e6e1dd8571831.zip
This commit was generated by cvs2svn to compensate for changes in r6227,
which included commits to RCS files with non-trunk default branches. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c40
1 files changed, 8 insertions, 32 deletions
diff --git a/regexec.c b/regexec.c
index 1bae0d951..581fe64b6 100644
--- a/regexec.c
+++ b/regexec.c
@@ -362,26 +362,11 @@ typedef struct {
};\
} while(0)
-static unsigned int MatchStackLimitSize = DEFAULT_MATCH_STACK_LIMIT_SIZE;
-
-extern unsigned int
-onig_get_match_stack_limit_size(void)
-{
- return MatchStackLimitSize;
-}
-
-extern int
-onig_set_match_stack_limit_size(unsigned int size)
-{
- MatchStackLimitSize = size;
- return 0;
-}
-
static int
stack_double(StackType** arg_stk_base, StackType** arg_stk_end,
StackType** arg_stk, StackType* stk_alloc, MatchArg* msa)
{
- unsigned int n;
+ int n;
StackType *x, *stk_base, *stk_end, *stk;
stk_base = *arg_stk_base;
@@ -400,12 +385,7 @@ stack_double(StackType** arg_stk_base, StackType** arg_stk_end,
}
else {
n *= 2;
- if (MatchStackLimitSize != 0 && n > MatchStackLimitSize) {
- if ((unsigned int )(stk_end - stk_base) == MatchStackLimitSize)
- return ONIGERR_MATCH_STACK_LIMIT_OVER;
- else
- n = MatchStackLimitSize;
- }
+ if (n > MATCH_STACK_LIMIT_SIZE) return ONIGERR_MATCH_STACK_LIMIT_OVER;
x = (StackType* )xrealloc(stk_base, sizeof(StackType) * n);
if (IS_NULL(x)) {
STACK_SAVE;
@@ -2593,13 +2573,11 @@ bm_search_notrev(regex_t* reg, UChar* target, UChar* target_end,
if (t < target) return p + 1;
skip = reg->map[*s];
- p = s + 1;
- if (p >= text_end) return (UChar* )NULL;
+ p++;
t = p;
- do {
+ while ((p - t) < skip) {
p += enc_len(reg->enc, *p);
- } while ((p - t) < skip && p < text_end);
-
+ }
s += (p - t);
}
}
@@ -2613,13 +2591,11 @@ bm_search_notrev(regex_t* reg, UChar* target, UChar* target_end,
if (t < target) return p + 1;
skip = reg->int_map[*s];
- p = s + 1;
- if (p >= text_end) return (UChar* )NULL;
+ p++;
t = p;
- do {
+ while ((p - t) < skip) {
p += enc_len(reg->enc, *p);
- } while ((p - t) < skip && p < text_end);
-
+ }
s += (p - t);
}
}