Apply several clang-tidy fixes

This commit is contained in:
Jan Niklas Hasse 2022-03-25 07:56:30 +01:00
parent 529470f1d0
commit dcdb7442a4
4 changed files with 13 additions and 20 deletions

View File

@ -86,13 +86,11 @@ void Triangle::MarkNeighbor(Triangle& t)
void Triangle::Clear()
{
Triangle *t;
for( int i=0; i<3; i++ )
{
t = neighbors_[i];
if( t != nullptr )
{
t->ClearNeighbor( this );
}
for (auto& neighbor : neighbors_) {
t = neighbor;
if (t != nullptr) {
t->ClearNeighbor(this);
}
}
ClearNeighbors();
points_[0]=points_[1]=points_[2] = nullptr;
@ -410,4 +408,4 @@ bool IsDelaunay(const std::vector<p2t::Triangle*>& triangles)
return true;
}
}
} // namespace p2t

View File

@ -107,4 +107,4 @@ AdvancingFront::~AdvancingFront()
{
}
}
} // namespace p2t

View File

@ -815,10 +815,9 @@ void Sweep::FlipScanEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle&
Sweep::~Sweep() {
// Clean up memory
for(size_t i = 0; i < nodes_.size(); i++) {
delete nodes_[i];
for (auto& node : nodes_) {
delete node;
}
}
} // namespace p2t

View File

@ -194,17 +194,13 @@ SweepContext::~SweepContext()
delete af_middle_;
delete af_tail_;
typedef std::list<Triangle*> type_list;
for(type_list::iterator iter = map_.begin(); iter != map_.end(); ++iter) {
Triangle* ptr = *iter;
delete ptr;
for (auto ptr : map_) {
delete ptr;
}
for(unsigned int i = 0; i < edge_list.size(); i++) {
delete edge_list[i];
for (auto& i : edge_list) {
delete i;
}
}
} // namespace p2t