diff --git a/include/cantera/kinetics/FalloffFactory.h b/include/cantera/kinetics/FalloffFactory.h index 925521b4f..1fea22ff3 100644 --- a/include/cantera/kinetics/FalloffFactory.h +++ b/include/cantera/kinetics/FalloffFactory.h @@ -117,10 +117,8 @@ public: virtual void deleteFactory() { ScopedLock lock(falloff_mutex); - if (s_factory) { - delete s_factory; - s_factory = 0; - } + delete s_factory; + s_factory = 0; } //! Return a pointer to a new falloff function calculator. diff --git a/include/cantera/kinetics/KineticsFactory.h b/include/cantera/kinetics/KineticsFactory.h index ea58cf429..0ad0e36fb 100644 --- a/include/cantera/kinetics/KineticsFactory.h +++ b/include/cantera/kinetics/KineticsFactory.h @@ -40,10 +40,8 @@ public: virtual void deleteFactory() { ScopedLock lock(kinetics_mutex); - if (s_factory) { - delete s_factory ; - s_factory = 0 ; - } + delete s_factory ; + s_factory = 0 ; } /** diff --git a/include/cantera/thermo/ThermoFactory.h b/include/cantera/thermo/ThermoFactory.h index 61006a6d3..cb65704e6 100644 --- a/include/cantera/thermo/ThermoFactory.h +++ b/include/cantera/thermo/ThermoFactory.h @@ -72,10 +72,8 @@ public: //! delete the static instance of this factory virtual void deleteFactory() { ScopedLock lock(thermo_mutex); - if (s_factory) { - delete s_factory; - s_factory = 0; - } + delete s_factory; + s_factory = 0; } //! Create a new thermodynamic property manager. diff --git a/include/cantera/zeroD/ReactorFactory.h b/include/cantera/zeroD/ReactorFactory.h index 2d67b703a..800428eb9 100644 --- a/include/cantera/zeroD/ReactorFactory.h +++ b/include/cantera/zeroD/ReactorFactory.h @@ -29,10 +29,8 @@ public: virtual void deleteFactory() { ScopedLock lock(reactor_mutex); - if (s_factory) { - delete s_factory; - s_factory = 0; - } + delete s_factory; + s_factory = 0; } /** diff --git a/src/base/units.h b/src/base/units.h index 787484af9..b8d1e7aca 100644 --- a/src/base/units.h +++ b/src/base/units.h @@ -40,10 +40,8 @@ public: */ static void deleteUnit() { ScopedLock lock(units_mutex); - if (s_u) { - delete s_u; - s_u = 0; - } + delete s_u; + s_u = 0; } //! Empty Destructor diff --git a/src/equil/vcs_MultiPhaseEquil.cpp b/src/equil/vcs_MultiPhaseEquil.cpp index 69372523d..8bc4c51dd 100644 --- a/src/equil/vcs_MultiPhaseEquil.cpp +++ b/src/equil/vcs_MultiPhaseEquil.cpp @@ -69,10 +69,8 @@ vcs_MultiPhaseEquil::~vcs_MultiPhaseEquil() { delete m_vprob; m_vprob = 0; - if (m_vsolvePtr) { - delete m_vsolvePtr; - m_vsolvePtr = 0; - } + delete m_vsolvePtr; + m_vsolvePtr = 0; } int vcs_MultiPhaseEquil::equilibrate_TV(int XY, doublereal xtarget, diff --git a/src/thermo/DebyeHuckel.cpp b/src/thermo/DebyeHuckel.cpp index 2e27bc339..a133e7ccb 100644 --- a/src/thermo/DebyeHuckel.cpp +++ b/src/thermo/DebyeHuckel.cpp @@ -144,10 +144,8 @@ operator=(const DebyeHuckel& b) m_densWaterSS = b.m_densWaterSS; - if (m_waterProps) { - delete m_waterProps; - m_waterProps = 0; - } + delete m_waterProps; + m_waterProps = 0; if (b.m_waterProps) { m_waterProps = new WaterProps(m_waterSS); } @@ -164,10 +162,8 @@ operator=(const DebyeHuckel& b) DebyeHuckel::~DebyeHuckel() { - if (m_waterProps) { - delete m_waterProps; - m_waterProps = 0; - } + delete m_waterProps; + m_waterProps = 0; } ThermoPhase* DebyeHuckel::duplMyselfAsThermoPhase() const diff --git a/src/thermo/HMWSoln.cpp b/src/thermo/HMWSoln.cpp index 5916a14a2..918f90e29 100644 --- a/src/thermo/HMWSoln.cpp +++ b/src/thermo/HMWSoln.cpp @@ -255,10 +255,8 @@ operator=(const HMWSoln& b) m_densWaterSS = b.m_densWaterSS; - if (m_waterProps) { - delete m_waterProps; - m_waterProps = 0; - } + delete m_waterProps; + m_waterProps = 0; if (b.m_waterProps) { m_waterProps = new WaterProps(dynamic_cast(m_waterSS)); } @@ -535,10 +533,8 @@ HMWSoln::HMWSoln(int testProb) : HMWSoln::~HMWSoln() { - if (m_waterProps) { - delete m_waterProps; - m_waterProps = 0; - } + delete m_waterProps; + m_waterProps = 0; } ThermoPhase* HMWSoln::duplMyselfAsThermoPhase() const diff --git a/src/thermo/Phase.cpp b/src/thermo/Phase.cpp index a8a669ebc..52c4dc3dc 100644 --- a/src/thermo/Phase.cpp +++ b/src/thermo/Phase.cpp @@ -86,10 +86,8 @@ Phase& Phase::operator=(const Phase& right) * to have our own individual copies of the XML data tree * in each object */ - if (m_xml) { - delete m_xml; - m_xml = 0; - } + delete m_xml; + m_xml = 0; if (right.m_xml) { m_xml = new XML_Node(); (right.m_xml)->copy(m_xml); @@ -102,10 +100,8 @@ Phase& Phase::operator=(const Phase& right) Phase::~Phase() { - if (m_xml) { - delete m_xml; - m_xml = 0; - } + delete m_xml; + m_xml = 0; } XML_Node& Phase::xml() diff --git a/src/thermo/SpeciesThermoFactory.cpp b/src/thermo/SpeciesThermoFactory.cpp index 37163bc56..69788b56d 100644 --- a/src/thermo/SpeciesThermoFactory.cpp +++ b/src/thermo/SpeciesThermoFactory.cpp @@ -121,10 +121,8 @@ SpeciesThermoFactory* SpeciesThermoFactory::factory() void SpeciesThermoFactory::deleteFactory() { ScopedLock lock(species_thermo_mutex); - if (s_factory) { - delete s_factory; - s_factory = 0; - } + delete s_factory; + s_factory = 0; } SpeciesThermo* SpeciesThermoFactory::newSpeciesThermo(std::vector & spDataNodeList) const diff --git a/src/thermo/VPSSMgrFactory.cpp b/src/thermo/VPSSMgrFactory.cpp index 2d56e057f..12b9d4c7f 100644 --- a/src/thermo/VPSSMgrFactory.cpp +++ b/src/thermo/VPSSMgrFactory.cpp @@ -189,10 +189,8 @@ static void getVPSSMgrTypes(std::vector & spDataNodeList, void VPSSMgrFactory::deleteFactory() { ScopedLock lock(vpss_species_thermo_mutex); - if (s_factory) { - delete s_factory; - s_factory = 0; - } + delete s_factory; + s_factory = 0; } VPSSMgr_enumType diff --git a/src/thermo/VPStandardStateTP.cpp b/src/thermo/VPStandardStateTP.cpp index 3f802c5b5..5b7d77945 100644 --- a/src/thermo/VPStandardStateTP.cpp +++ b/src/thermo/VPStandardStateTP.cpp @@ -79,10 +79,7 @@ VPStandardStateTP::operator=(const VPStandardStateTP& b) /* * Duplicate the VPSS Manager object that conducts the calculations */ - if (m_VPSS_ptr) { - delete m_VPSS_ptr; - m_VPSS_ptr = 0; - } + delete m_VPSS_ptr; m_VPSS_ptr = (b.m_VPSS_ptr)->duplMyselfAsVPSSMgr(); /* diff --git a/src/thermo/WaterProps.cpp b/src/thermo/WaterProps.cpp index 9e111604b..6464b55ad 100644 --- a/src/thermo/WaterProps.cpp +++ b/src/thermo/WaterProps.cpp @@ -72,10 +72,7 @@ WaterProps& WaterProps::operator=(const WaterProps& b) } if (m_own_sub) { - if (m_waterIAPWS) { - delete m_waterIAPWS; - m_waterIAPWS = 0; - } + delete m_waterIAPWS; } if (b.m_own_sub) { m_waterIAPWS = new WaterPropsIAPWS(); diff --git a/src/thermo/WaterSSTP.cpp b/src/thermo/WaterSSTP.cpp index 91ece89ce..fbc7659bd 100644 --- a/src/thermo/WaterSSTP.cpp +++ b/src/thermo/WaterSSTP.cpp @@ -196,10 +196,8 @@ initThermoXML(XML_Node& phaseNode, const std::string& id) /* * We have to do something with the thermo function here. */ - if (m_spthermo) { - delete m_spthermo; - m_spthermo = 0; - } + delete m_spthermo; + m_spthermo = 0; /* * Set the flag to say we are ready to calculate stuff diff --git a/src/transport/TransportFactory.cpp b/src/transport/TransportFactory.cpp index d57c39c87..107e5420b 100644 --- a/src/transport/TransportFactory.cpp +++ b/src/transport/TransportFactory.cpp @@ -216,10 +216,8 @@ TransportFactory::TransportFactory() : void TransportFactory::deleteFactory() { ScopedLock transportLock(transport_mutex); - if (s_factory) { - delete s_factory; - s_factory = 0; - } + delete s_factory; + s_factory = 0; } std::string TransportFactory::modelName(int model)