remove code preventing firing callbacks in the history buffer

This commit is contained in:
Alex Coyte 2016-09-01 09:55:53 +10:00 committed by Matthew Barr
parent c3b5efefb6
commit efa3299774
3 changed files with 5 additions and 40 deletions

View File

@ -655,12 +655,6 @@ char nfaExecGough8_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
const u8 *cur_buf = sp < 0 ? hend : buffer; const u8 *cur_buf = sp < 0 ? hend : buffer;
char report = 1;
if (mode == CALLBACK_OUTPUT) {
/* we are starting inside the history buffer: matches are suppressed */
report = !(sp < 0);
}
if (mode != NO_MATCHES && q->items[q->cur - 1].location > end) { if (mode != NO_MATCHES && q->items[q->cur - 1].location > end) {
/* this is as far as we go */ /* this is as far as we go */
q->cur--; q->cur--;
@ -691,8 +685,7 @@ char nfaExecGough8_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
const u8 *final_look; const u8 *final_look;
if (goughExec8_i_ni(m, som, &s, cur_buf + sp, local_ep - sp, if (goughExec8_i_ni(m, som, &s, cur_buf + sp, local_ep - sp,
offset + sp, cb, context, &final_look, offset + sp, cb, context, &final_look, mode)
report ? mode : NO_MATCHES)
== MO_HALT_MATCHING) { == MO_HALT_MATCHING) {
*(u8 *)q->state = 0; *(u8 *)q->state = 0;
return 0; return 0;
@ -724,7 +717,6 @@ char nfaExecGough8_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
if (sp == 0) { if (sp == 0) {
cur_buf = buffer; cur_buf = buffer;
report = 1;
} }
if (sp != ep) { if (sp != ep) {
@ -789,12 +781,6 @@ char nfaExecGough16_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
const u8 *cur_buf = sp < 0 ? hend : buffer; const u8 *cur_buf = sp < 0 ? hend : buffer;
char report = 1;
if (mode == CALLBACK_OUTPUT) {
/* we are starting inside the history buffer: matches are suppressed */
report = !(sp < 0);
}
assert(q->cur); assert(q->cur);
if (mode != NO_MATCHES && q->items[q->cur - 1].location > end) { if (mode != NO_MATCHES && q->items[q->cur - 1].location > end) {
/* this is as far as we go */ /* this is as far as we go */
@ -822,10 +808,8 @@ char nfaExecGough16_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
/* do main buffer region */ /* do main buffer region */
const u8 *final_look; const u8 *final_look;
if (goughExec16_i_ni(m, som, &s, cur_buf + sp, local_ep - sp, if (goughExec16_i_ni(m, som, &s, cur_buf + sp, local_ep - sp,
offset + sp, cb, context, &final_look, offset + sp, cb, context, &final_look, mode)
report ? mode : NO_MATCHES)
== MO_HALT_MATCHING) { == MO_HALT_MATCHING) {
assert(report);
*(u16 *)q->state = 0; *(u16 *)q->state = 0;
return 0; return 0;
} }
@ -856,7 +840,6 @@ char nfaExecGough16_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
if (sp == 0) { if (sp == 0) {
cur_buf = buffer; cur_buf = buffer;
report = 1;
} }
if (sp != ep) { if (sp != ep) {

View File

@ -496,12 +496,6 @@ char nfaExecMcClellan16_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
const u8 *cur_buf = sp < 0 ? hend : buffer; const u8 *cur_buf = sp < 0 ? hend : buffer;
char report = 1;
if (mode == CALLBACK_OUTPUT) {
/* we are starting inside the history buffer: matches are suppressed */
report = !(sp < 0);
}
assert(q->cur); assert(q->cur);
if (mode != NO_MATCHES && q->items[q->cur - 1].location > end) { if (mode != NO_MATCHES && q->items[q->cur - 1].location > end) {
DEBUG_PRINTF("this is as far as we go\n"); DEBUG_PRINTF("this is as far as we go\n");
@ -530,9 +524,8 @@ char nfaExecMcClellan16_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
const u8 *final_look; const u8 *final_look;
if (mcclellanExec16_i_ni(m, &s, cur_buf + sp, local_ep - sp, if (mcclellanExec16_i_ni(m, &s, cur_buf + sp, local_ep - sp,
offset + sp, cb, context, single, &final_look, offset + sp, cb, context, single, &final_look,
report ? mode : NO_MATCHES) mode)
== MO_HALT_MATCHING) { == MO_HALT_MATCHING) {
assert(report);
*(u16 *)q->state = 0; *(u16 *)q->state = 0;
return 0; return 0;
} }
@ -563,7 +556,6 @@ char nfaExecMcClellan16_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
if (sp == 0) { if (sp == 0) {
cur_buf = buffer; cur_buf = buffer;
report = 1;
} }
if (sp != ep) { if (sp != ep) {
@ -653,12 +645,6 @@ char nfaExecMcClellan8_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
const u8 *cur_buf = sp < 0 ? hend : buffer; const u8 *cur_buf = sp < 0 ? hend : buffer;
char report = 1;
if (mode == CALLBACK_OUTPUT) {
/* we are starting inside the history buffer: matches are suppressed */
report = !(sp < 0);
}
if (mode != NO_MATCHES && q->items[q->cur - 1].location > end) { if (mode != NO_MATCHES && q->items[q->cur - 1].location > end) {
DEBUG_PRINTF("this is as far as we go\n"); DEBUG_PRINTF("this is as far as we go\n");
q->cur--; q->cur--;
@ -687,8 +673,7 @@ char nfaExecMcClellan8_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
const u8 *final_look; const u8 *final_look;
if (mcclellanExec8_i_ni(m, &s, cur_buf + sp, local_ep - sp, offset + sp, if (mcclellanExec8_i_ni(m, &s, cur_buf + sp, local_ep - sp, offset + sp,
cb, context, single, &final_look, cb, context, single, &final_look, mode)
report ? mode : NO_MATCHES)
== MO_HALT_MATCHING) { == MO_HALT_MATCHING) {
*(u8 *)q->state = 0; *(u8 *)q->state = 0;
return 0; return 0;
@ -720,7 +705,6 @@ char nfaExecMcClellan8_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
if (sp == 0) { if (sp == 0) {
cur_buf = buffer; cur_buf = buffer;
report = 1;
} }
if (sp != ep) { if (sp != ep) {

View File

@ -405,9 +405,7 @@ char runSheng(const struct sheng *sh, struct mq *q, s64a b_end,
const u8 * scanned = cur_buf; const u8 * scanned = cur_buf;
char rv; char rv;
/* if we're in nomatch mode or if we're scanning history buffer */ if (mode == NO_MATCHES) {
if (mode == NO_MATCHES ||
(cur_start < 0 && mode == CALLBACK_OUTPUT)) {
runShengNm(sh, q->cb, q->context, q->offset, runShengNm(sh, q->cb, q->context, q->offset,
&cached_accept_state, &cached_accept_id, cur_buf, &cached_accept_state, &cached_accept_id, cur_buf,
cur_buf + cur_start, cur_buf + cur_end, can_die, cur_buf + cur_start, cur_buf + cur_end, can_die,