From ecf4c35df39672c99e638045087266d2cd098cfa Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Tue, 8 Jan 2013 16:29:17 -0800 Subject: [PATCH] cyclegraph: add const --- cyclegraph.cc | 8 ++++---- cyclegraph.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cyclegraph.cc b/cyclegraph.cc index 3949b6e..e3d0d83 100644 --- a/cyclegraph.cc +++ b/cyclegraph.cc @@ -6,7 +6,7 @@ /** Initializes a CycleGraph object. */ CycleGraph::CycleGraph() : - discovered(new HashTable(16)), + discovered(new HashTable(16)), hasCycles(false), oldCycles(false), hasRMWViolation(false), @@ -198,15 +198,15 @@ bool CycleGraph::checkReachable(const ModelAction *from, const ModelAction *to) * @param to The CycleNode to reach * @return True, @a from can reach @a to; otherwise, false */ -bool CycleGraph::checkReachable(CycleNode *from, CycleNode *to) const +bool CycleGraph::checkReachable(const CycleNode *from, const CycleNode *to) const { - std::vector< CycleNode *, ModelAlloc > queue; + std::vector< const CycleNode *, ModelAlloc > queue; discovered->reset(); queue.push_back(from); discovered->put(from, from); while (!queue.empty()) { - CycleNode *node = queue.back(); + const CycleNode *node = queue.back(); queue.pop_back(); if (node == to) return true; diff --git a/cyclegraph.h b/cyclegraph.h index f2f3032..45e49fb 100644 --- a/cyclegraph.h +++ b/cyclegraph.h @@ -42,7 +42,7 @@ class CycleGraph { private: void putNode(const ModelAction *act, CycleNode *node); CycleNode * getNode(const ModelAction *); - HashTable *discovered; + HashTable *discovered; /** @brief A table for mapping ModelActions to CycleNodes */ HashTable actionToNode; @@ -50,7 +50,7 @@ class CycleGraph { std::vector nodeList; #endif - bool checkReachable(CycleNode *from, CycleNode *to) const; + bool checkReachable(const CycleNode *from, const CycleNode *to) const; /** @brief A flag: true if this graph contains cycles */ bool hasCycles; -- 2.34.1