office-gobmx/external/hunspell/0004-either-clear-will-be-called-anyway-before-use-or-its.patch
Caolán McNamara 163435fa23 use alternative optimizations for buffer creation bottleneck
Change-Id: I9f29e8d3e5e97fe403a3e0d7d03c6ac01c7689c4
2017-02-12 21:16:59 +00:00

81 lines
2.7 KiB
Diff

From aab258adbd9c78931a36b96e58975a08000249a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Fri, 10 Feb 2017 17:14:35 +0000
Subject: [PATCH 4/4] either clear will be called anyway before use, or its
unused afterwards
---
src/hunspell/suggestmgr.cxx | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/hunspell/suggestmgr.cxx b/src/hunspell/suggestmgr.cxx
index ea52707..ae34535 100644
--- a/src/hunspell/suggestmgr.cxx
+++ b/src/hunspell/suggestmgr.cxx
@@ -1089,7 +1089,6 @@ void SuggestMgr::ngsuggest(std::vector<std::string>& wlst,
continue;
if (utf8) {
- w_f.clear();
u8_u16(w_f, HENTRY_WORD(hp));
int leftcommon = leftcommonsubstring(w_word, w_f);
@@ -1115,7 +1114,6 @@ void SuggestMgr::ngsuggest(std::vector<std::string>& wlst,
copy_field(f, HENTRY_DATA(hp), MORPH_PHON)) {
int sc2;
if (utf8) {
- w_f.clear();
u8_u16(w_f, f);
int leftcommon = leftcommonsubstring(w_word, w_f);
@@ -1139,7 +1137,6 @@ void SuggestMgr::ngsuggest(std::vector<std::string>& wlst,
int scphon = -20000;
if (ph && (sc > 2) && (abs(n - (int)hp->clen) <= 3)) {
if (utf8) {
- w_candidate.clear();
u8_u16(w_candidate, HENTRY_WORD(hp));
mkallcap_utf(w_candidate, langnum);
u16_u8(candidate, w_candidate);
@@ -1148,7 +1145,6 @@ void SuggestMgr::ngsuggest(std::vector<std::string>& wlst,
mkallcap(candidate, csconv);
}
f = phonet(candidate, *ph);
- w_f.clear();
if (utf8) {
u8_u16(w_f, f);
scphon = 2 * ngram(3, w_target, w_f,
@@ -1254,7 +1250,6 @@ void SuggestMgr::ngsuggest(std::vector<std::string>& wlst,
for (int k = 0; k < nw; k++) {
if (utf8) {
- w_f.clear();
u8_u16(w_f, glst[k].word);
int leftcommon = leftcommonsubstring(w_word, w_f);
@@ -1335,7 +1330,6 @@ void SuggestMgr::ngsuggest(std::vector<std::string>& wlst,
std::string gl;
int len;
if (utf8) {
- w_gl.clear();
len = u8_u16(w_gl, guess[i]);
mkallsmall_utf(w_gl, langnum);
u16_u8(gl, w_gl);
@@ -1355,7 +1349,6 @@ void SuggestMgr::ngsuggest(std::vector<std::string>& wlst,
}
// using 2-gram instead of 3, and other weightening
- w_gl.clear();
if (utf8) {
u8_u16(w_gl, gl);
//w_gl is lowercase already at this point
@@ -1421,7 +1414,6 @@ void SuggestMgr::ngsuggest(std::vector<std::string>& wlst,
// lowering rootphon[i]
std::string gl;
int len;
- w_gl.clear();
if (utf8) {
len = u8_u16(w_gl, rootsphon[i]);
mkallsmall_utf(w_gl, langnum);
--
2.9.3