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,11 +86,9 @@ void Triangle::MarkNeighbor(Triangle& t)
void Triangle::Clear() void Triangle::Clear()
{ {
Triangle *t; Triangle *t;
for( int i=0; i<3; i++ ) for (auto& neighbor : neighbors_) {
{ t = neighbor;
t = neighbors_[i]; if (t != nullptr) {
if( t != nullptr )
{
t->ClearNeighbor(this); t->ClearNeighbor(this);
} }
} }
@ -410,4 +408,4 @@ bool IsDelaunay(const std::vector<p2t::Triangle*>& triangles)
return true; 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() { Sweep::~Sweep() {
// Clean up memory // Clean up memory
for(size_t i = 0; i < nodes_.size(); i++) { for (auto& node : nodes_) {
delete nodes_[i]; delete node;
} }
} }
} // namespace p2t } // namespace p2t

View File

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