From b4ec5a5d10c547f238c335a89329a03f30b32b4b Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 24 Jul 2014 13:38:56 +1000 Subject: Ensure all fields initialised in constructor. --- src/RESearch.cxx | 17 +++++++---------- src/RESearch.h | 1 - 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/RESearch.cxx b/src/RESearch.cxx index 74db01355..138469f0a 100644 --- a/src/RESearch.cxx +++ b/src/RESearch.cxx @@ -203,6 +203,7 @@ #include #include +#include #include "CharClassify.h" #include "RESearch.h" @@ -251,22 +252,18 @@ const char bitarr[] = { 1, 2, 4, 8, 16, 32, 64, '\200' }; RESearch::RESearch(CharClassify *charClassTable) { failure = 0; charClass = charClassTable; - Init(); + sta = NOP; /* status of lastpat */ + bol = 0; + std::fill(bittab, bittab + BITBLK, 0); + std::fill(tagstk, tagstk + MAXTAG, 0); + std::fill(nfa, nfa + MAXNFA, 0); + Clear(); } RESearch::~RESearch() { Clear(); } -void RESearch::Init() { - sta = NOP; /* status of lastpat */ - bol = 0; - for (int i = 0; i < MAXTAG; i++) - pat[i].clear(); - for (int j = 0; j < BITBLK; j++) - bittab[j] = 0; -} - void RESearch::Clear() { for (int i = 0; i < MAXTAG; i++) { pat[i].clear(); diff --git a/src/RESearch.h b/src/RESearch.h index 48533a41c..38875a3f4 100644 --- a/src/RESearch.h +++ b/src/RESearch.h @@ -46,7 +46,6 @@ public: std::string pat[MAXTAG]; private: - void Init(); void Clear(); void ChSet(unsigned char c); void ChSetWithCase(unsigned char c, bool caseSensitive); -- cgit v1.2.3