From: Justin Viiret Date: Tue, 11 Oct 2016 04:36:16 +0000 (+1100) Subject: smallwrite: minimize DFAs if they have been pruned X-Git-Tag: v4.4.0^2~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=054749f9ee22cf4bdbe700ab2c86136f520d6499;p=thirdparty%2Fvectorscan.git smallwrite: minimize DFAs if they have been pruned --- diff --git a/src/smallwrite/smallwrite_build.cpp b/src/smallwrite/smallwrite_build.cpp index 65361c6f..d395a7af 100644 --- a/src/smallwrite/smallwrite_build.cpp +++ b/src/smallwrite/smallwrite_build.cpp @@ -30,6 +30,7 @@ #include "grey.h" #include "ue2common.h" +#include "nfa/dfa_min.h" #include "nfa/mcclellancompile.h" #include "nfa/mcclellancompile_util.h" #include "nfa/nfa_internal.h" @@ -208,7 +209,9 @@ void SmallWriteBuildImpl::add(const NGWrapper &w) { return; } - prune_overlong(*r, cc.grey.smallWriteLargestBuffer); + if (prune_overlong(*r, cc.grey.smallWriteLargestBuffer)) { + minimize_hopcroft(*r, cc.grey); + } if (rdfa) { // do a merge of the new dfa with the existing dfa @@ -418,6 +421,7 @@ aligned_unique_ptr prepEngine(raw_dfa &rdfa, u32 roseQuality, return nullptr; } if (prune_overlong(rdfa, *small_region - *start_offset)) { + minimize_hopcroft(rdfa, cc.grey); if (rdfa.start_anchored == DEAD_STATE) { DEBUG_PRINTF("all patterns pruned out\n"); return nullptr;