aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2014-07-24 13:38:56 +1000
committerNeil <nyamatongwe@gmail.com>2014-07-24 13:38:56 +1000
commitcbca5c51806f5020da1455471424ba62bb0571cb (patch)
tree34b3b697409e459b48ee4d8429ee2be90b23d3e7
parent2a833a9ea04ecb588591a63276a9039940855575 (diff)
downloadscintilla-mirror-cbca5c51806f5020da1455471424ba62bb0571cb.tar.gz
Ensure all fields initialised in constructor.
-rw-r--r--src/RESearch.cxx17
-rw-r--r--src/RESearch.h1
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);