diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-01-26 18:23:42 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-01-31 14:27:06 (GMT) |
commit | 65c0a64dc5bc7cb0e13721500bdd754b6630e8ea (patch) | |
tree | 327a4dc86d33fb406ebeea660c61ec7bc863907d /Source/cmComputeComponentGraph.cxx | |
parent | 50abdaab936e6b1a7e40d17affae03f89ac00da6 (diff) | |
download | CMake-65c0a64dc5bc7cb0e13721500bdd754b6630e8ea.zip CMake-65c0a64dc5bc7cb0e13721500bdd754b6630e8ea.tar.gz CMake-65c0a64dc5bc7cb0e13721500bdd754b6630e8ea.tar.bz2 |
cmComputeComponentGraph: use a name for "invalid component"
This is to prepare for making the graph use `size_t`.
Diffstat (limited to 'Source/cmComputeComponentGraph.cxx')
-rw-r--r-- | Source/cmComputeComponentGraph.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/cmComputeComponentGraph.cxx b/Source/cmComputeComponentGraph.cxx index 6591fb1..6826f23 100644 --- a/Source/cmComputeComponentGraph.cxx +++ b/Source/cmComputeComponentGraph.cxx @@ -5,6 +5,8 @@ #include <algorithm> #include <cassert> +const int cmComputeComponentGraph::INVALID_COMPONENT = -1; + cmComputeComponentGraph::cmComputeComponentGraph(Graph const& input) : InputGraph(input) { @@ -30,7 +32,7 @@ void cmComputeComponentGraph::Tarjan() this->TarjanEntries.resize(0); this->TarjanEntries.resize(n, entry); this->TarjanComponents.resize(0); - this->TarjanComponents.resize(n, -1); + this->TarjanComponents.resize(n, INVALID_COMPONENT); this->TarjanWalkId = 0; this->TarjanVisited.resize(0); this->TarjanVisited.resize(n, 0); @@ -52,7 +54,7 @@ void cmComputeComponentGraph::TarjanVisit(int i) // Initialize the entry. this->TarjanEntries[i].Root = i; - this->TarjanComponents[i] = -1; + this->TarjanComponents[i] = INVALID_COMPONENT; this->TarjanEntries[i].VisitIndex = ++this->TarjanIndex; this->TarjanStack.push(i); @@ -77,7 +79,7 @@ void cmComputeComponentGraph::TarjanVisit(int i) // If the destination has not yet been assigned to a component, // check if it has a better root for the current object. - if (this->TarjanComponents[j] < 0) { + if (this->TarjanComponents[j] == INVALID_COMPONENT) { if (this->TarjanEntries[this->TarjanEntries[j].Root].VisitIndex < this->TarjanEntries[this->TarjanEntries[i].Root].VisitIndex) { this->TarjanEntries[i].Root = this->TarjanEntries[j].Root; |