Remove unnecessary conditional surrounding 'delete' statements

This commit is contained in:
Ray Speth 2014-01-06 18:45:19 +00:00
parent 7e88d49734
commit 607955b9f2
15 changed files with 34 additions and 72 deletions

View file

@ -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.

View file

@ -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 ;
}
/**

View file

@ -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.

View file

@ -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;
}
/**

View file

@ -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

View file

@ -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,

View file

@ -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

View file

@ -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<PDSS_Water*>(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

View file

@ -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()

View file

@ -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<XML_Node*> & spDataNodeList) const

View file

@ -189,10 +189,8 @@ static void getVPSSMgrTypes(std::vector<XML_Node*> & 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

View file

@ -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();
/*

View file

@ -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();

View file

@ -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

View file

@ -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)