@@ -210,6 +210,17 @@ namespace {
210210 unsigned blocks = 0 ;
211211 unsigned duplicateLines = 0 ;
212212
213+ auto reportSeq = [&options, &source1, &source2, &outFile](int line1, int line2, int count) {
214+ ReportSeq (
215+ line1,
216+ line2,
217+ count,
218+ options.GetOutputXml (),
219+ source1,
220+ source2,
221+ outFile);
222+ };
223+
213224 // Scan vertical part
214225 for (size_t y = 0 ; y < m; y++) {
215226 unsigned seqLen = 0 ;
@@ -223,14 +234,7 @@ namespace {
223234 int line2 = x - seqLen;
224235 if (line1 != line2 || source1 != source2) {
225236 duplicateLines += seqLen;
226- ReportSeq (
227- line1,
228- line2,
229- seqLen,
230- options.GetOutputXml (),
231- source1,
232- source2,
233- outFile);
237+ reportSeq (line1, line2, seqLen);
234238 blocks++;
235239 }
236240 }
@@ -244,14 +248,7 @@ namespace {
244248 int line2 = n - seqLen;
245249 if (line1 != line2 || source1 != source2) {
246250 duplicateLines += seqLen;
247- ReportSeq (
248- line1,
249- line2,
250- seqLen,
251- options.GetOutputXml (),
252- source1,
253- source2,
254- outFile);
251+ reportSeq (line1, line2, seqLen);
255252 blocks++;
256253 }
257254 }
@@ -268,14 +265,7 @@ namespace {
268265 } else {
269266 if (seqLen >= lMinBlockSize) {
270267 duplicateLines += seqLen;
271- ReportSeq (
272- y - seqLen,
273- x + y - seqLen,
274- seqLen,
275- options.GetOutputXml (),
276- source1,
277- source2,
278- outFile);
268+ reportSeq (y - seqLen, x + y - seqLen, seqLen);
279269 blocks++;
280270 }
281271 seqLen = 0 ;
@@ -284,14 +274,7 @@ namespace {
284274
285275 if (seqLen >= lMinBlockSize) {
286276 duplicateLines += seqLen;
287- ReportSeq (
288- m - seqLen,
289- n - seqLen,
290- seqLen,
291- options.GetOutputXml (),
292- source1,
293- source2,
294- outFile);
277+ reportSeq (m - seqLen, n - seqLen, seqLen);
295278 blocks++;
296279 }
297280 }
0 commit comments