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;
@ -65,7 +62,6 @@ IFSG_APPEARANCE::IFSG_APPEARANCE( SGNODE* aParent )
}
m_node->AssociateWrapper( &m_node );
}
}
@ -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;
@ -95,7 +89,6 @@ IFSG_APPEARANCE::IFSG_APPEARANCE( IFSG_NODE& aParent )
}
m_node->AssociateWrapper( &m_node );
}
}

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;
@ -65,7 +62,6 @@ IFSG_COLORS::IFSG_COLORS( SGNODE* aParent )
}
m_node->AssociateWrapper( &m_node );
}
}
@ -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;
@ -97,7 +91,6 @@ IFSG_COLORS::IFSG_COLORS( IFSG_NODE& aParent )
}
m_node->AssociateWrapper( &m_node );
}
}

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;
@ -65,7 +62,6 @@ IFSG_COORDS::IFSG_COORDS( SGNODE* aParent )
}
m_node->AssociateWrapper( &m_node );
}
}
@ -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;
@ -95,7 +89,6 @@ IFSG_COORDS::IFSG_COORDS( IFSG_NODE& aParent )
}
m_node->AssociateWrapper( &m_node );
}
}

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;
@ -66,7 +63,6 @@ IFSG_FACESET::IFSG_FACESET( SGNODE* aParent )
}
m_node->AssociateWrapper( &m_node );
}
}
@ -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;
@ -96,7 +90,6 @@ IFSG_FACESET::IFSG_FACESET( IFSG_NODE& aParent )
}
m_node->AssociateWrapper( &m_node );
}
}

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;
@ -66,7 +63,6 @@ IFSG_NORMALS::IFSG_NORMALS( SGNODE* aParent )
}
m_node->AssociateWrapper( &m_node );
}
}
@ -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;
@ -96,7 +90,6 @@ IFSG_NORMALS::IFSG_NORMALS( IFSG_NODE& aParent )
}
m_node->AssociateWrapper( &m_node );
}
}

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;
@ -66,7 +63,6 @@ IFSG_SHAPE::IFSG_SHAPE( SGNODE* aParent )
}
m_node->AssociateWrapper( &m_node );
}
}
@ -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;
@ -96,7 +90,6 @@ IFSG_SHAPE::IFSG_SHAPE( IFSG_NODE& aParent )
}
m_node->AssociateWrapper( &m_node );
}
}

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;
@ -65,7 +62,6 @@ IFSG_TRANSFORM::IFSG_TRANSFORM( SGNODE* aParent )
}
m_node->AssociateWrapper( &m_node );
}
}