Skip to content

Commit 9c90b04

Browse files
committed
deflookup: split DefLookup::lookup() into two fncs
... to make the code easier to follow. No change in behavior intended with this commit. Related: #98
1 parent 8c2b06f commit 9c90b04

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/lib/deflookup.cc

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ void DefLookup::hashDefect(const Defect &def)
7878
defList.push_back(def);
7979
}
8080

81+
static bool defLookupCore(TDefList &defList)
82+
{
83+
// just remove an arbitrary one
84+
// TODO: add some other criteria in order to make the match more precise
85+
unsigned cnt = defList.size();
86+
if (cnt)
87+
defList.resize(cnt - 1);
88+
else
89+
return false;
90+
91+
return true;
92+
}
93+
8194
bool DefLookup::lookup(const Defect &def)
8295
{
8396
// look for defect class
@@ -116,15 +129,11 @@ bool DefLookup::lookup(const Defect &def)
116129
if (byMsg.end() == itByMsg)
117130
return false;
118131

119-
// FIXME: nasty over-approximation
132+
// process the resulting list of defects sequentially
120133
TDefList &defList = itByMsg->second;
121-
unsigned cnt = defList.size();
122-
if (cnt)
123-
// just remove an arbitrary one
124-
defList.resize(cnt - 1);
125-
else
134+
if (!defLookupCore(defList))
126135
return false;
127136

128-
// TODO: add some other criteria in order to make the match more precise
137+
// found!
129138
return true;
130139
}

0 commit comments

Comments
 (0)