1 From 93156ba9a8e644f8b0b724880668714adcb0d094 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
3 Date: Mon, 23 Jan 2017 12:05:07 +0000
4 Subject: [PATCH] cppcheck: rv is reassigned before old value used
7 src/hunspell/affixmgr.cxx | 6 ++----
8 src/hunspell/suggestmgr.cxx | 3 +--
9 2 files changed, 3 insertions(+), 6 deletions(-)
11 diff --git a/src/hunspell/affixmgr.cxx b/src/hunspell/affixmgr.cxx
12 index 680cbe9..21cf384 100644
13 --- a/src/hunspell/affixmgr.cxx
14 +++ b/src/hunspell/affixmgr.cxx
15 @@ -1494,9 +1494,8 @@ int AffixMgr::defcpd_check(hentry*** words,
18 inline int AffixMgr::candidate_check(const char* word, int len) {
19 - struct hentry* rv = NULL;
22 + struct hentry* rv = lookup(word);
26 @@ -3045,10 +3044,9 @@ struct hentry* AffixMgr::affix_check(const char* word,
30 - struct hentry* rv = NULL;
32 // check all prefixes (also crossed with suffixes if allowed)
33 - rv = prefix_check(word, len, in_compound, needflag);
34 + struct hentry* rv = prefix_check(word, len, in_compound, needflag);
38 diff --git a/src/hunspell/suggestmgr.cxx b/src/hunspell/suggestmgr.cxx
39 index 8d46dd6..54a474f 100644
40 --- a/src/hunspell/suggestmgr.cxx
41 +++ b/src/hunspell/suggestmgr.cxx
42 @@ -1675,11 +1675,10 @@ std::string SuggestMgr::suggest_hentry_gen(hentry* rv, const char* pattern) {
44 p = (char*)strstr(HENTRY_DATA2(rv), MORPH_ALLOMORPH);
46 - struct hentry* rv2 = NULL;
48 int plen = fieldlen(p);
49 std::string allomorph(p, plen);
50 - rv2 = pAMgr->lookup(allomorph.c_str());
51 + struct hentry* rv2 = pAMgr->lookup(allomorph.c_str());
53 // if (HENTRY_DATA(rv2) && get_sfxcount(HENTRY_DATA(rv2)) <=