1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* regexec.c (OPCODE_EXEC_HOOK): op is p-1 because p is already

incremented.

* regexec.c (OPCODE_EXEC_HOOK): use the exact end address.

* regexec.c (match_at): don't call OPCODE_EXEC_HOOK in CASE()
  when it comes from goto fail.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2016-10-03 21:06:50 +00:00
parent 011e45c6ec
commit e342418e46
2 changed files with 23 additions and 9 deletions

View file

@ -1,3 +1,13 @@
Tue Oct 4 05:53:11 2016 NARUSE, Yui <naruse@ruby-lang.org>
* regexec.c (OPCODE_EXEC_HOOK): op is p-1 because p is already
incremented.
* regexec.c (OPCODE_EXEC_HOOK): use the exact end address.
* regexec.c (match_at): don't call OPCODE_EXEC_HOOK in CASE()
when it comes from goto fail.
Mon Oct 3 21:24:41 2016 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
* NEWS: mention Readline.quoting_detection_proc{,=}.

View file

@ -1613,12 +1613,13 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
#ifdef ONIG_DEBUG_MATCH
#define OPCODE_EXEC_HOOK \
if (s) { \
UChar *q, *bp, buf[50]; \
UChar *op, *q, *bp, buf[50]; \
int len; \
fprintf(stderr, "%4"PRIdPTR"> \"", (*p == OP_FINISH) ? (ptrdiff_t )-1 : s - str); \
op = p - 1; \
fprintf(stderr, "%4"PRIdPTR"> \"", (*op == OP_FINISH) ? (ptrdiff_t )-1 : s - str); \
bp = buf; \
q = s; \
if (*p != OP_FINISH) { /* s may not be a valid pointer if OP_FINISH. */ \
if (*op != OP_FINISH) { /* s may not be a valid pointer if OP_FINISH. */ \
for (i = 0; i < 7 && q < end; i++) { \
len = enclen(encode, q, end); \
while (len-- > 0) *bp++ = *q++; \
@ -1629,8 +1630,8 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
*bp = 0; \
fputs((char* )buf, stderr); \
for (i = 0; i < 20 - (bp - buf); i++) fputc(' ', stderr); \
fprintf(stderr, "%4"PRIdPTR":", (p == FinishCode) ? (ptrdiff_t )-1 : p - reg->p); \
onig_print_compiled_byte_code(stderr, p, p + strlen((char *)p),NULL, encode); \
fprintf(stderr, "%4"PRIdPTR":", (op == FinishCode) ? (ptrdiff_t )-1 : op - reg->p); \
onig_print_compiled_byte_code(stderr, op, reg->p+reg->used, NULL, encode); \
fprintf(stderr, "\n"); \
}
#else
@ -3064,10 +3065,13 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
goto finish;
NEXT;
CASE(OP_FAIL)
if (0) {
/* fall */
fail:
MOP_OUT;
/* fall */
CASE(OP_FAIL) MOP_IN(OP_FAIL);
}
MOP_IN(OP_FAIL);
STACK_POP;
p = stk->u.state.pcode;
s = stk->u.state.pstr;