From 0c022ae9bf5884a444902301882eba54f1a13f0d Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 12 Jun 2021 12:29:13 -0700 Subject: [PATCH] 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. --- lib/vpsc/blocks.cpp | 6 +++--- lib/vpsc/blocks.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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; -- 2.40.0