Skip to content

Commit

Permalink
STYLE: Place QELineCell objects in QuadEdgeMesh test on the stack
Browse files Browse the repository at this point in the history
Following C++ Core Guidelines, Oct 3, 2024, "Prefer scoped objects, don’t
heap-allocate unnecessarily",
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#r5-prefer-scoped-objects-dont-heap-allocate-unnecessarily
  • Loading branch information
N-Dekker committed Nov 2, 2024
1 parent 851e5b0 commit 3dabff7
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshCellInterfaceTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -411,29 +411,30 @@ itkQuadEdgeMeshCellInterfaceTest(int, char *[])
mesh->Accept(multiVisitor);

// test 4 very specific QELineCell destructor cases
auto * test = new QELineCellType();
QEType * m_QuadEdgeGeom = test->GetQEGeom();
delete m_QuadEdgeGeom->GetRot()->GetRot()->GetRot();
m_QuadEdgeGeom->GetRot()->GetRot()->SetRot(nullptr);
delete test;

test = new QELineCellType();
m_QuadEdgeGeom = test->GetQEGeom();
delete m_QuadEdgeGeom->GetRot()->GetRot()->GetRot();
m_QuadEdgeGeom->GetRot()->GetRot()->SetRot(nullptr);
delete m_QuadEdgeGeom->GetRot()->GetRot();
m_QuadEdgeGeom->GetRot()->SetRot(nullptr);
delete test;

test = new QELineCellType();
m_QuadEdgeGeom = test->GetQEGeom();
delete m_QuadEdgeGeom->GetRot()->GetRot()->GetRot();
m_QuadEdgeGeom->GetRot()->GetRot()->SetRot(nullptr);
delete m_QuadEdgeGeom->GetRot()->GetRot();
m_QuadEdgeGeom->GetRot()->SetRot(nullptr);
delete m_QuadEdgeGeom->GetRot();
m_QuadEdgeGeom->SetRot(nullptr);
delete test;
{
QELineCellType test;
QEType * m_QuadEdgeGeom = test.GetQEGeom();
delete m_QuadEdgeGeom->GetRot()->GetRot()->GetRot();
m_QuadEdgeGeom->GetRot()->GetRot()->SetRot(nullptr);
}
{
QELineCellType test;
QEType * m_QuadEdgeGeom = test.GetQEGeom();
delete m_QuadEdgeGeom->GetRot()->GetRot()->GetRot();
m_QuadEdgeGeom->GetRot()->GetRot()->SetRot(nullptr);
delete m_QuadEdgeGeom->GetRot()->GetRot();
m_QuadEdgeGeom->GetRot()->SetRot(nullptr);
}
{
QELineCellType test;
QEType * m_QuadEdgeGeom = test.GetQEGeom();
delete m_QuadEdgeGeom->GetRot()->GetRot()->GetRot();
m_QuadEdgeGeom->GetRot()->GetRot()->SetRot(nullptr);
delete m_QuadEdgeGeom->GetRot()->GetRot();
m_QuadEdgeGeom->GetRot()->SetRot(nullptr);
delete m_QuadEdgeGeom->GetRot();
m_QuadEdgeGeom->SetRot(nullptr);
}

return status;
}

0 comments on commit 3dabff7

Please sign in to comment.