diff options
| author | Neil <nyamatongwe@gmail.com> | 2014-07-24 13:38:56 +1000 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2014-07-24 13:38:56 +1000 | 
| commit | b4ec5a5d10c547f238c335a89329a03f30b32b4b (patch) | |
| tree | c47baa3f9c729a3c070f358c0ca9a2ba2a7fc747 | |
| parent | 7afb5fb389fe0c59e6952e1f5b6861105fab3bad (diff) | |
| download | scintilla-mirror-b4ec5a5d10c547f238c335a89329a03f30b32b4b.tar.gz | |
Ensure all fields initialised in constructor.
| -rw-r--r-- | src/RESearch.cxx | 17 | ||||
| -rw-r--r-- | src/RESearch.h | 1 | 
2 files changed, 7 insertions, 11 deletions
| 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 <stdlib.h>  #include <string> +#include <algorithm>  #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); | 
