summaryrefslogtreecommitdiff
path: root/regex.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-04-20 08:21:41 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-04-20 08:21:41 +0000
commit8852d54df49dd08207748ea537f23710add98c97 (patch)
treeb5b47d883790531624ab8e898673af038c7a40e4 /regex.c
parent4b3d078462f3d9306e56649bd818e0f54c214f18 (diff)
to open CVS
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/regex.c b/regex.c
index 17cf330..86db3fc 100644
--- a/regex.c
+++ b/regex.c
@@ -2638,15 +2638,12 @@ re_compile_fastmap(bufp)
bufp->can_be_null = 1;
fastmap['\n'] = 1;
case anychar:
- {
- char ex = (options & RE_OPTION_POSIX)?'\0':'\n';
-
- for (j = 0; j < (1 << BYTEWIDTH); j++) {
- if (j != ex) fastmap[j] = 1;
- }
- if (bufp->can_be_null) {
- FREE_AND_RETURN_VOID(stackb);
- }
+ for (j = 0; j < (1 << BYTEWIDTH); j++) {
+ if (j != '\n' || (options & RE_OPTION_POSIX))
+ fastmap[j] = 1;
+ }
+ if (bufp->can_be_null) {
+ FREE_AND_RETURN_VOID(stackb);
}
/* Don't return; check the alternative paths
so we can set can_be_null if appropriate. */
@@ -3141,7 +3138,7 @@ typedef union
#define IS_A_LETTER(d) (SYNTAX(*(d)) == Sword || \
(current_mbctype ? \
- re_mbctab[*(d)] : \
+ (re_mbctab[*(d)] && ((d)+mbclen(*(d)))<=dend): \
SYNTAX(*(d)) == Sword2))
#define PREV_IS_A_LETTER(d) ((current_mbctype == MBCTYPE_SJIS)? \
@@ -3305,7 +3302,6 @@ re_match(bufp, string_arg, size, pos, regs)
d = string + pos, dend = string + size;
-
/* This loops over pattern commands. It exits by returning from the
function if match is complete, or it drops through if match fails
at this starting point in the input data. */
@@ -3553,8 +3549,8 @@ re_match(bufp, string_arg, size, pos, regs)
d += mbclen(*d);
break;
}
- if (((TRANSLATE_P()) ? translate[*d] : *d) ==
- ((options&RE_OPTION_POSIX) ? '\0' : '\n'))
+ if (!(options&RE_OPTION_POSIX) &&
+ (TRANSLATE_P() ? translate[*d] : *d) == '\n')
goto fail;
SET_REGS_MATCHED;
d++;