1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-15 03:48:02 +08:00

source: Pass cmCTestResourceAllocator::Resource by value

This commit is contained in:
Daniel Pfeifer
2025-07-15 20:41:52 +02:00
committed by Brad King
parent ee1c32b6d7
commit 964e992ec5
2 changed files with 9 additions and 14 deletions

View File

@@ -72,15 +72,3 @@ bool cmCTestResourceAllocator::DeallocateResource(std::string const& name,
resIt->second.Locked -= slots;
return true;
}
bool cmCTestResourceAllocator::Resource::operator==(
Resource const& other) const
{
return this->Total == other.Total && this->Locked == other.Locked;
}
bool cmCTestResourceAllocator::Resource::operator!=(
Resource const& other) const
{
return !(*this == other);
}

View File

@@ -17,8 +17,15 @@ public:
unsigned int Free() const { return this->Total - this->Locked; }
bool operator==(Resource const& other) const;
bool operator!=(Resource const& other) const;
friend bool operator==(Resource left, Resource right)
{
return left.Total == right.Total && left.Locked == right.Locked;
}
friend bool operator!=(Resource left, Resource right)
{
return !(left == right);
}
};
void InitializeFromResourceSpec(cmCTestResourceSpec const& spec);