]> granicus.if.org Git - graphviz/commitdiff
remove unnecessary manual indexing in generateYConstraints
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 11 Apr 2021 02:30:26 +0000 (19:30 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 18 Apr 2021 02:56:42 +0000 (19:56 -0700)
It’s a little hard to see because the variable i is also shadowed within this
loop, but the loop index is unnecessary.

lib/vpsc/generate-constraints.cpp

index 3ca616c0e87212f606890a211c5a9498566548c3..400651576f7d9f132b39bcdaea47c33b165ed881 100644 (file)
@@ -239,8 +239,7 @@ int generateYConstraints(const int n, Rectangle** rs, Variable** vars, Constrain
        std::sort(events.begin(), events.end(), compare_events);
        NodeSet scanline;
        vector<Constraint*> constraints;
-       for(i=0;i<2*n;i++) {
-               Event &e=events[i];
+       for(Event &e : events) {
                Node *v=e.v;
                if(e.type==Open) {
                        scanline.insert(v);