Minor code clean, standard "new" does not need to be null checked

Because it will bad_alloc exception you instead :D
Silence PVS Studio V668 Warnings
This commit is contained in:
Marek Roszko 2021-02-16 18:24:19 -05:00
parent b959378d58
commit 2370ca1b0e
9 changed files with 100 additions and 155 deletions

View File

@ -234,14 +234,6 @@ SGNODE* S3D::ReadCache( const char* aFileName, void* aPluginMgr,
SGNODE* np = new SCENEGRAPH( nullptr );
if( nullptr == np )
{
wxLogTrace( MASK_3D_SG, "%s:%s:%d * [INFO] failed to instantiate SCENEGRAPH",
__FILE__, __FUNCTION__, __LINE__ );
return nullptr;
}
OPEN_ISTREAM( file, aFileName );
if( file.fail() )

View File

@ -43,7 +43,6 @@ IFSG_APPEARANCE::IFSG_APPEARANCE( bool create )
m_node = new SGAPPEARANCE( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
}
@ -52,8 +51,6 @@ IFSG_APPEARANCE::IFSG_APPEARANCE( SGNODE* aParent )
{
m_node = new SGAPPEARANCE( nullptr );
if( m_node )
{
if( !m_node->SetParent( aParent ) )
{
delete m_node;
@ -66,7 +63,6 @@ IFSG_APPEARANCE::IFSG_APPEARANCE( SGNODE* aParent )
m_node->AssociateWrapper( &m_node );
}
}
IFSG_APPEARANCE::IFSG_APPEARANCE( IFSG_NODE& aParent )
@ -82,8 +78,6 @@ IFSG_APPEARANCE::IFSG_APPEARANCE( IFSG_NODE& aParent )
m_node = new SGAPPEARANCE( nullptr );
if( m_node )
{
if( !m_node->SetParent( pp ) )
{
delete m_node;
@ -96,7 +90,6 @@ IFSG_APPEARANCE::IFSG_APPEARANCE( IFSG_NODE& aParent )
m_node->AssociateWrapper( &m_node );
}
}
bool IFSG_APPEARANCE::Attach( SGNODE* aNode )

View File

@ -43,7 +43,6 @@ IFSG_COLORS::IFSG_COLORS( bool create )
m_node = new SGCOLORS( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
}
@ -52,8 +51,6 @@ IFSG_COLORS::IFSG_COLORS( SGNODE* aParent )
{
m_node = new SGCOLORS( nullptr );
if( m_node )
{
if( !m_node->SetParent( aParent ) )
{
delete m_node;
@ -66,7 +63,6 @@ IFSG_COLORS::IFSG_COLORS( SGNODE* aParent )
m_node->AssociateWrapper( &m_node );
}
}
IFSG_COLORS::IFSG_COLORS( IFSG_NODE& aParent )
@ -83,8 +79,6 @@ IFSG_COLORS::IFSG_COLORS( IFSG_NODE& aParent )
m_node = new SGCOLORS( nullptr );
if( m_node )
{
if( !m_node->SetParent( pp ) )
{
delete m_node;
@ -98,7 +92,6 @@ IFSG_COLORS::IFSG_COLORS( IFSG_NODE& aParent )
m_node->AssociateWrapper( &m_node );
}
}
bool IFSG_COLORS::Attach( SGNODE* aNode )

View File

@ -44,7 +44,6 @@ IFSG_COORDINDEX::IFSG_COORDINDEX( bool create )
m_node = new SGCOORDINDEX( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
}

View File

@ -43,7 +43,6 @@ IFSG_COORDS::IFSG_COORDS( bool create )
m_node = new SGCOORDS( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
}
@ -52,8 +51,6 @@ IFSG_COORDS::IFSG_COORDS( SGNODE* aParent )
{
m_node = new SGCOORDS( nullptr );
if( m_node )
{
if( !m_node->SetParent( aParent ) )
{
delete m_node;
@ -66,7 +63,6 @@ IFSG_COORDS::IFSG_COORDS( SGNODE* aParent )
m_node->AssociateWrapper( &m_node );
}
}
IFSG_COORDS::IFSG_COORDS( IFSG_NODE& aParent )
@ -82,8 +78,6 @@ IFSG_COORDS::IFSG_COORDS( IFSG_NODE& aParent )
m_node = new SGCOORDS( nullptr );
if( m_node )
{
if( !m_node->SetParent( pp ) )
{
delete m_node;
@ -96,7 +90,6 @@ IFSG_COORDS::IFSG_COORDS( IFSG_NODE& aParent )
m_node->AssociateWrapper( &m_node );
}
}
bool IFSG_COORDS::Attach( SGNODE* aNode )

View File

@ -44,7 +44,6 @@ IFSG_FACESET::IFSG_FACESET( bool create )
m_node = new SGFACESET( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
}
@ -53,8 +52,6 @@ IFSG_FACESET::IFSG_FACESET( SGNODE* aParent )
{
m_node = new SGFACESET( nullptr );
if( m_node )
{
if( !m_node->SetParent( aParent ) )
{
delete m_node;
@ -67,7 +64,6 @@ IFSG_FACESET::IFSG_FACESET( SGNODE* aParent )
m_node->AssociateWrapper( &m_node );
}
}
IFSG_FACESET::IFSG_FACESET( IFSG_NODE& aParent )
@ -83,8 +79,6 @@ IFSG_FACESET::IFSG_FACESET( IFSG_NODE& aParent )
m_node = new SGFACESET( nullptr );
if( m_node )
{
if( !m_node->SetParent( pp ) )
{
delete m_node;
@ -97,7 +91,6 @@ IFSG_FACESET::IFSG_FACESET( IFSG_NODE& aParent )
m_node->AssociateWrapper( &m_node );
}
}
bool IFSG_FACESET::Attach( SGNODE* aNode )

View File

@ -44,7 +44,6 @@ IFSG_NORMALS::IFSG_NORMALS( bool create )
m_node = new SGNORMALS( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
}
@ -53,8 +52,6 @@ IFSG_NORMALS::IFSG_NORMALS( SGNODE* aParent )
{
m_node = new SGNORMALS( nullptr );
if( m_node )
{
if( !m_node->SetParent( aParent ) )
{
delete m_node;
@ -67,7 +64,6 @@ IFSG_NORMALS::IFSG_NORMALS( SGNODE* aParent )
m_node->AssociateWrapper( &m_node );
}
}
IFSG_NORMALS::IFSG_NORMALS( IFSG_NODE& aParent )
@ -83,8 +79,6 @@ IFSG_NORMALS::IFSG_NORMALS( IFSG_NODE& aParent )
m_node = new SGNORMALS( nullptr );
if( m_node )
{
if( !m_node->SetParent( pp ) )
{
delete m_node;
@ -97,7 +91,6 @@ IFSG_NORMALS::IFSG_NORMALS( IFSG_NODE& aParent )
m_node->AssociateWrapper( &m_node );
}
}
bool IFSG_NORMALS::Attach( SGNODE* aNode )

View File

@ -44,7 +44,6 @@ IFSG_SHAPE::IFSG_SHAPE( bool create )
m_node = new SGSHAPE( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
}
@ -53,8 +52,6 @@ IFSG_SHAPE::IFSG_SHAPE( SGNODE* aParent )
{
m_node = new SGSHAPE( nullptr );
if( m_node )
{
if( !m_node->SetParent( aParent ) )
{
delete m_node;
@ -67,7 +64,6 @@ IFSG_SHAPE::IFSG_SHAPE( SGNODE* aParent )
m_node->AssociateWrapper( &m_node );
}
}
IFSG_SHAPE::IFSG_SHAPE( IFSG_NODE& aParent )
@ -83,8 +79,6 @@ IFSG_SHAPE::IFSG_SHAPE( IFSG_NODE& aParent )
m_node = new SGSHAPE( nullptr );
if( m_node )
{
if( !m_node->SetParent( pp ) )
{
delete m_node;
@ -97,7 +91,6 @@ IFSG_SHAPE::IFSG_SHAPE( IFSG_NODE& aParent )
m_node->AssociateWrapper( &m_node );
}
}
bool IFSG_SHAPE::Attach( SGNODE* aNode )

View File

@ -43,7 +43,6 @@ IFSG_TRANSFORM::IFSG_TRANSFORM( bool create )
m_node = new SCENEGRAPH( nullptr );
if( m_node )
m_node->AssociateWrapper( &m_node );
}
@ -52,8 +51,6 @@ IFSG_TRANSFORM::IFSG_TRANSFORM( SGNODE* aParent )
{
m_node = new SCENEGRAPH( nullptr );
if( m_node )
{
if( !m_node->SetParent( aParent ) )
{
delete m_node;
@ -66,7 +63,6 @@ IFSG_TRANSFORM::IFSG_TRANSFORM( SGNODE* aParent )
m_node->AssociateWrapper( &m_node );
}
}
bool IFSG_TRANSFORM::Attach( SGNODE* aNode )