stream: simplify do_rebuild call site

This commit is contained in:
Justin Viiret 2017-01-31 09:53:16 +11:00 committed by Matthew Barr
parent 76f72b6ab4
commit cfa63a7096

View File

@ -413,13 +413,9 @@ void ensureStreamNeatAndTidy(const struct RoseEngine *t, char *state,
static really_inline static really_inline
void do_rebuild(const struct RoseEngine *t, struct hs_scratch *scratch) { void do_rebuild(const struct RoseEngine *t, struct hs_scratch *scratch) {
assert(t->drmatcherOffset);
assert(!can_stop_matching(scratch)); assert(!can_stop_matching(scratch));
if (!t->drmatcherOffset) {
DEBUG_PRINTF("no delayed rebuild table\n");
return;
}
const struct HWLM *hwlm = getByOffset(t, t->drmatcherOffset); const struct HWLM *hwlm = getByOffset(t, t->drmatcherOffset);
size_t len = MIN(scratch->core_info.hlen, t->delayRebuildLength); size_t len = MIN(scratch->core_info.hlen, t->delayRebuildLength);
const u8 *buf = scratch->core_info.hbuf + scratch->core_info.hlen - len; const u8 *buf = scratch->core_info.hbuf + scratch->core_info.hlen - len;
@ -641,17 +637,14 @@ void roseStreamExec(const struct RoseEngine *t, struct hs_scratch *scratch) {
rebuild, scratch->core_info.status, rebuild, scratch->core_info.status,
t->maxFloatingDelayedMatch, offset); t->maxFloatingDelayedMatch, offset);
if (!flen) {
if (rebuild) { /* rebuild floating delayed match stuff */
do_rebuild(t, scratch);
}
goto flush_delay_and_exit;
}
if (rebuild) { /* rebuild floating delayed match stuff */ if (rebuild) { /* rebuild floating delayed match stuff */
do_rebuild(t, scratch); do_rebuild(t, scratch);
} }
if (!flen) {
goto flush_delay_and_exit;
}
if (flen + offset <= t->floatingMinDistance) { if (flen + offset <= t->floatingMinDistance) {
DEBUG_PRINTF("skip FLOATING: before floating min\n"); DEBUG_PRINTF("skip FLOATING: before floating min\n");
goto flush_delay_and_exit; goto flush_delay_and_exit;