Skip to content

Commit 5039b87

Browse files
cuelliusCaolán McNamara
authored and
Caolán McNamara
committed
Do not extra iteration if can
1 parent 07a6c18 commit 5039b87

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/hunspell/suggestmgr.cxx

+4-1
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,7 @@ void SuggestMgr::ngsuggest(std::vector<std::string>& wlst,
10911091
std::string w2;
10921092
const char* word = w;
10931093

1094+
int nc;
10941095
// word reversing wrapper for complex prefixes
10951096
if (complexprefixes) {
10961097
w2.assign(w);
@@ -1099,10 +1100,12 @@ void SuggestMgr::ngsuggest(std::vector<std::string>& wlst,
10991100
else
11001101
reverseword(w2);
11011102
word = w2.c_str();
1103+
nc = (int)w2.size();
1104+
} else {
1105+
nc = (int)strlen(word);
11021106
}
11031107

11041108
std::vector<w_char> u8;
1105-
int nc = strlen(word);
11061109
int n = (utf8) ? u8_u16(u8, word) : nc;
11071110

11081111
// set character based ngram suggestion for words with non-BMP Unicode

0 commit comments

Comments
 (0)