Skip to content
Snippets Groups Projects
Commit 66c60b4f authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

Fix calculation of debug output

Instead of printing the total of inspected elements, the code
just pointed one element after the array.
Add proper code to sum up the number of inspected elements.
This was found by cppcheck
parent 6b8a3bcf
No related branches found
No related tags found
1 merge request!227Fix a couple of cppcheck findings
......@@ -1670,6 +1670,8 @@ static void URule2Mrule (const URULE *ur, MGIO_RR_RULE *mr)
static void WriteDebugInfo (void)
{
long N_rm=0,N_er=0;
long Nelem_inspected = 0;
long Nelem_not_inspected = 0;
int tag;
/* number of rules (rm+er) */
......@@ -1681,6 +1683,8 @@ static void WriteDebugInfo (void)
long n_er = global.maxrule[tag]-UGMAXRULE(tag);
N_rm += n_rm;
N_er += n_er;
Nelem_inspected = global.nelem_inspected[tag];
Nelem_not_inspected += global.nelem_not_inspected[tag];
PrintDebug("tag %d: %3ld rm rules, %4ld extracted rules (elems inspected: %6ld yes %6ld no)\n",
tag,
n_rm,
......@@ -1691,8 +1695,8 @@ static void WriteDebugInfo (void)
PrintDebug("total: %3ld rm rules, %4ld extracted rules (elems inspected: %6ld yes %6ld no)\n",
N_rm,
N_er,
global.nelem_inspected[tag],
global.nelem_not_inspected[tag]);
Nelem_inspected,
Nelem_not_inspected);
PrintDebug("------------------------------------------------------\n");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment