File: rrsim_iterator_cppcheck.patch

package info (click to toggle)
boinc 8.2.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 104,688 kB
  • sloc: cpp: 172,875; php: 115,929; pascal: 56,058; xml: 17,863; python: 8,752; javascript: 6,538; sh: 5,343; objc: 2,322; ansic: 2,200; makefile: 2,166; perl: 1,843; sql: 831; java: 429; lisp: 47; csh: 30
file content (41 lines) | stat: -rw-r--r-- 1,045 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Description: this patch avoid the iterator reuse, fixing cppcheck warnings
--- a/client/rrsim_test.cpp
+++ b/client/rrsim_test.cpp
@@ -184,7 +184,6 @@
     vector<RESULT*> active;
     unsigned int i;
     double x;
-    vector<RESULT*>::iterator it;
     bool rval = false;
 
     if (log_flags.rr_simulation) {
@@ -287,7 +286,9 @@
         int last_active_size = active.size();
         int last_proj_active_size = pbest->active.size();
 
-        // remove *rpbest from active set,
+        {
+        vector<RESULT*>::iterator it;
+	// remove *rpbest from active set,
         // and adjust CPU time left for other results
         //
         it = active.begin();
@@ -301,7 +302,10 @@
                 ++it;
             }
         }
+	}
 
+	{
+        vector<RESULT*>::iterator it;
         // remove *rpbest from its project's active set
         //
         it = pbest->active.begin();
@@ -313,6 +317,7 @@
                 ++it;
             }
         }
+	}
 
         // If project has more results, add one to active set.
         //