diff options
author | Luca <deri@ntop.org> | 2021-06-09 08:57:58 +0200 |
---|---|---|
committer | Luca <deri@ntop.org> | 2021-06-09 08:58:18 +0200 |
commit | 1a8ae710cfb7ec395057e926090c900552ceb623 (patch) | |
tree | fe91dca708289a3f083849acc8f6bd71795bd456 /src/lib/third_party | |
parent | 65e67a2f883ca1cf3e8a4955d0ed25ca6b59d66d (diff) |
Minor code cleanup
Diffstat (limited to 'src/lib/third_party')
-rw-r--r-- | src/lib/third_party/src/ahocorasick.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/lib/third_party/src/ahocorasick.c b/src/lib/third_party/src/ahocorasick.c index 034a932d3..bb695f037 100644 --- a/src/lib/third_party/src/ahocorasick.c +++ b/src/lib/third_party/src/ahocorasick.c @@ -875,19 +875,20 @@ static AC_NODE_t *node_findbs_next_ac (AC_NODE_t * thiz, uint8_t alpha,int icase static int node_has_matchstr (AC_NODE_t * thiz, AC_PATTERN_t * newstr) { int i; - AC_PATTERN_t * str; + if(!thiz->matched_patterns) return 0; - str = thiz->matched_patterns->patterns; - - for (i=0; i < thiz->matched_patterns->num; str++,i++) - { - if (str->length != newstr->length) - continue; - - if(!memcmp(str->astring,newstr->astring,str->length)) - return 1; - - } + + for (i=0; i < thiz->matched_patterns->num; i++) + { + AC_PATTERN_t *str = &(thiz->matched_patterns->patterns[i]); + + if (str->length != newstr->length) + continue; + + if(!memcmp(str->astring,newstr->astring,str->length)) + return 1; + } + return 0; } |