]> granicus.if.org Git - graphviz/commitdiff
cut variable dependency and push closer to its use in generateYConstraints
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 11 Apr 2021 02:32:44 +0000 (19:32 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 18 Apr 2021 02:56:42 +0000 (19:56 -0700)
lib/vpsc/generate-constraints.cpp

index a4eccc4f2804d3c74b66e82d94e78ac276b2b9b8..58dd53baddaa75b84597c329570d9e39fd4a3509 100644 (file)
@@ -229,8 +229,8 @@ int generateXConstraints(const int n, Rectangle** rs, Variable** vars, Constrain
 int generateYConstraints(const int n, Rectangle** rs, Variable** vars, Constraint** &cs) {
        vector<Event> events;
        events.reserve(2 * n);
-       int i,m;
-       for(i=0;i<n;i++) {
+       int m;
+       for(int i=0;i<n;i++) {
                vars[i]->desiredPosition=rs[i]->getCentreY();
                Node *v = new Node(vars[i],rs[i],rs[i]->getCentreY());
                events.emplace_back(Open,v,rs[i]->getMinX());
@@ -273,6 +273,6 @@ int generateYConstraints(const int n, Rectangle** rs, Variable** vars, Constrain
                }
        }
        cs=new Constraint*[m=constraints.size()];
-       for(i=0;i<m;i++) cs[i]=constraints[i];
+       for(int i=0;i<m;i++) cs[i]=constraints[i];
        return m;
 }