Skip to content

Commit

Permalink
Merge pull request #20219 from ianna/geom-clang-readability-delete-nu…
Browse files Browse the repository at this point in the history
…ll-pointer

Geometry Clang Check readability-delete-null-pointer
  • Loading branch information
cmsbuild committed Aug 22, 2017
2 parents 09041a6 + 2cfb1c1 commit 8ca8b5b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Geometry/EcalAlgo/src/EcalBarrelGeometry.cc
Expand Up @@ -38,7 +38,7 @@ EcalBarrelGeometry::~EcalBarrelGeometry()
{
auto ptr = m_borderPtrVec.load(std::memory_order_acquire);
for(auto& v: (*ptr)) {
if(v) delete v;
delete v;
v = nullptr;
}
delete m_borderPtrVec.load() ;
Expand Down Expand Up @@ -481,7 +481,7 @@ EcalBarrelGeometry::avgRadiusXYFrontFaceCenter() const
for( uint32_t i ( 0 ) ; i != m_cellVec.size() ; ++i )
{
const CaloCellGeometry* cell ( cellGeomPtr(i) ) ;
if( 0 != cell )
if( nullptr != cell )
{
const GlobalPoint& pos ( cell->getPosition() ) ;
sum += pos.perp() ;
Expand All @@ -498,5 +498,5 @@ EcalBarrelGeometry::cellGeomPtr( uint32_t index ) const
{
const CaloCellGeometry* cell ( &m_cellVec[ index ] ) ;
return ( m_cellVec.size() < index ||
0 == cell->param() ? 0 : cell ) ;
nullptr == cell->param() ? nullptr : cell ) ;
}
16 changes: 8 additions & 8 deletions Geometry/EcalAlgo/src/EcalEndcapGeometry.cc
Expand Up @@ -45,7 +45,7 @@ EcalEndcapGeometry::~EcalEndcapGeometry()
{
auto ptr = m_borderPtrVec.load(std::memory_order_acquire);
for(auto& v: (*ptr)) {
if(v) delete v;
delete v;
v = nullptr;
}
delete m_borderPtrVec.load() ;
Expand Down Expand Up @@ -88,7 +88,7 @@ EcalEndcapGeometry::initializeParms()
for( uint32_t i ( 0 ) ; i != m_cellVec.size() ; ++i )
{
const CaloCellGeometry* cell ( cellGeomPtr(i) ) ;
if( 0 != cell )
if( nullptr != cell )
{
const CCGFloat z ( cell->getPosition().z() ) ;
if(z>0.)
Expand Down Expand Up @@ -122,9 +122,9 @@ EcalEndcapGeometry::initializeParms()
for( uint32_t i ( 0 ) ; i != m_cellVec.size() ; ++i )
{
const CaloCellGeometry* cell ( cellGeomPtr(i) ) ;
if( 0 != cell )
if( nullptr != cell )
{
const GlobalPoint p ( cell->getPosition() ) ;
const GlobalPoint& p ( cell->getPosition() ) ;
const CCGFloat z ( p.z() ) ;
const CCGFloat zz ( 0 > z ? zeN : zeP ) ;
const CCGFloat x ( p.x()*zz/z ) ;
Expand Down Expand Up @@ -264,7 +264,7 @@ EcalEndcapGeometry::getClosestCell( const GlobalPoint& r ) const
// compute the distance of the point with respect of the 4 crystal lateral planes


if( 0 != getGeometry(mycellID) )
if( nullptr != getGeometry(mycellID) )
{
const GlobalPoint& myPosition=getGeometry(mycellID)->getPosition();

Expand Down Expand Up @@ -432,7 +432,7 @@ EcalEndcapGeometry::getClosestBarrelCells( EEDetId id ) const
OrderedListOfEBDetId* ptr ( nullptr ) ;
auto ptrVec = m_borderPtrVec.load(std::memory_order_acquire);
if(!ptrVec) {
if(0 != id.rawId() && 0 != getGeometry(id)) {
if(0 != id.rawId() && nullptr != getGeometry(id)) {
const float phi(370.+getGeometry(id)->getPosition().phi().degrees());
const int iPhi(1+int(phi)%360) ;
const int iz(id.zside()) ;
Expand Down Expand Up @@ -505,7 +505,7 @@ EcalEndcapGeometry::avgAbsZFrontFaceCenter() const
for( unsigned int i ( 0 ) ; i != m_cellVec.size() ; ++i )
{
const CaloCellGeometry* cell ( cellGeomPtr(i) ) ;
if( 0 != cell )
if( nullptr != cell )
{
sum += fabs( cell->getPosition().z() ) ;
}
Expand All @@ -521,5 +521,5 @@ EcalEndcapGeometry::cellGeomPtr( uint32_t index ) const
{
const CaloCellGeometry* cell ( &m_cellVec[ index ] ) ;
return ( m_cellVec.size() < index ||
0 == cell->param() ? 0 : cell ) ;
nullptr == cell->param() ? nullptr : cell ) ;
}

0 comments on commit 8ca8b5b

Please sign in to comment.