From: Matthew Fernandez Date: Sat, 12 Jun 2021 19:29:13 +0000 (-0700) Subject: take a reference instead of a pointer in Blocks::dfsVisit X-Git-Tag: 2.48.0~44^2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c022ae9bf5884a444902301882eba54f1a13f0d;p=graphviz take a reference instead of a pointer in Blocks::dfsVisit This function has no ability to deal with being passed null, so it is cleaner to accept a reference. --- diff --git a/lib/vpsc/blocks.cpp b/lib/vpsc/blocks.cpp index a41a3e016..47ae790e6 100644 --- a/lib/vpsc/blocks.cpp +++ b/lib/vpsc/blocks.cpp @@ -61,14 +61,14 @@ list *Blocks::totalOrder() { } for(int i=0;iin.empty()) { - dfsVisit(vs[i],order); + dfsVisit(vs[i],*order); } } return order; } // Recursive depth first search giving total order by pushing nodes in the DAG // onto the front of the list when we finish searching them -void Blocks::dfsVisit(Variable *v, list *order) { +void Blocks::dfsVisit(Variable *v, list &order) { v->visited=true; vector::iterator it=v->out.begin(); for(;it!=v->out.end();it++) { @@ -81,7 +81,7 @@ void Blocks::dfsVisit(Variable *v, list *order) { ofstream f(LOGFILE,ios::app); f<<" order="<<*v<<"\n"; } - order->push_front(v); + order.push_front(v); } /** * Processes incoming constraints, most violated to least, merging with the diff --git a/lib/vpsc/blocks.h b/lib/vpsc/blocks.h index 7c3af91ee..b5b544236 100644 --- a/lib/vpsc/blocks.h +++ b/lib/vpsc/blocks.h @@ -46,7 +46,7 @@ public: void cleanup(); double cost(); private: - void dfsVisit(Variable *v, std::list *order); + void dfsVisit(Variable *v, std::list &order); void removeBlock(Block *doomed); Variable **vs; int nvs;