diff options
-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; |