From: Hong, Yang A Date: Thu, 17 Jan 2019 16:20:06 +0000 (+0800) Subject: mcclellan: fix dump issue in wide-state case. X-Git-Tag: v5.1.0^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5a8644b1f52a7d3cb0143b28bfe69654a64035f;p=thirdparty%2Fvectorscan.git mcclellan: fix dump issue in wide-state case. --- diff --git a/src/nfa/mcclellandump.cpp b/src/nfa/mcclellandump.cpp index a13795fd..92090bc5 100644 --- a/src/nfa/mcclellandump.cpp +++ b/src/nfa/mcclellandump.cpp @@ -275,7 +275,8 @@ void nfaExecMcClellan16_dumpDot(const NFA *nfa, FILE *f) { dumpDotPreambleDfa(f); - for (u16 i = 1; i < m->state_count; i++) { + u16 sherman_ceil = m->has_wide == 1 ? m->wide_limit : m->state_count; + for (u16 i = 1; i < sherman_ceil; i++) { describeNode(nfa, m, i, f); u16 t[ALPHABET_SIZE]; @@ -314,7 +315,8 @@ void dumpAccelMasks(FILE *f, const mcclellan *m, const mstate_aux *aux) { fprintf(f, "Acceleration\n"); fprintf(f, "------------\n"); - for (u16 i = 0; i < m->state_count; i++) { + u16 sherman_ceil = m->has_wide == 1 ? m->wide_limit : m->state_count; + for (u16 i = 0; i < sherman_ceil; i++) { if (!aux[i].accel_offset) { continue; } @@ -360,7 +362,8 @@ void dumpCommonHeader(FILE *f, const mcclellan *m) { static void dumpTransitions(FILE *f, const NFA *nfa, const mcclellan *m, const mstate_aux *aux) { - for (u16 i = 0; i < m->state_count; i++) { + u16 sherman_ceil = m->has_wide == 1 ? m->wide_limit : m->state_count; + for (u16 i = 0; i < sherman_ceil; i++) { fprintf(f, "%05hu", i); if (aux[i].accel_offset) { dumpAccelText(f, (const union AccelAux *)((const char *)m +