diff options
author | Neil <nyamatongwe@gmail.com> | 2017-01-22 17:35:18 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2017-01-22 17:35:18 +1100 |
commit | eec253d225f0e3d8eb594b8dfa8fe24e2d2dcb17 (patch) | |
tree | e1446eeb71aeb00a63670d3cbbdc0b006d5b8de9 | |
parent | 9c124369f902a294e28a95a9af1df11add564ac1 (diff) | |
download | scintilla-mirror-eec253d225f0e3d8eb594b8dfa8fe24e2d2dcb17.tar.gz |
Simplify initialising and reinitialising.
-rw-r--r-- | lexlib/WordList.cxx | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lexlib/WordList.cxx b/lexlib/WordList.cxx index b8662916c..7741fe093 100644 --- a/lexlib/WordList.cxx +++ b/lexlib/WordList.cxx @@ -29,10 +29,7 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa int words = 0; // For rapid determination of whether a character is a separator, build // a look up table. - bool wordSeparator[256]; - for (int i=0; i<256; i++) { - wordSeparator[i] = false; - } + bool wordSeparator[256] = {}; // Initialise all to false. wordSeparator[static_cast<unsigned int>('\r')] = true; wordSeparator[static_cast<unsigned int>('\n')] = true; if (!onlyLineEnds) { @@ -134,8 +131,7 @@ void WordList::Set(const char *s) { #else SortWordList(words, len); #endif - for (unsigned int k = 0; k < ELEMENTS(starts); k++) - starts[k] = -1; + std::fill(starts, starts + ELEMENTS(starts), -1); for (int l = len - 1; l >= 0; l--) { unsigned char indexChar = words[l][0]; starts[indexChar] = l; |