Skip to content

Commit

Permalink
VoxelManipulator: Remove unnecessary deallocation steps
Browse files Browse the repository at this point in the history
  • Loading branch information
kwolekr committed Dec 28, 2014
1 parent 08d259c commit ae2721f
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/voxel.cpp
Expand Up @@ -46,21 +46,15 @@ VoxelManipulator::VoxelManipulator():
VoxelManipulator::~VoxelManipulator()
{
clear();
if(m_data)
delete[] m_data;
if(m_flags)
delete[] m_flags;
}

void VoxelManipulator::clear()
{
// Reset area to volume=0
m_area = VoxelArea();
if(m_data)
delete[] m_data;
delete[] m_data;
m_data = NULL;
if(m_flags)
delete[] m_flags;
delete[] m_flags;
m_flags = NULL;
}

Expand Down Expand Up @@ -215,10 +209,8 @@ void VoxelManipulator::addArea(const VoxelArea &area)
m_data = new_data;
m_flags = new_flags;

if(old_data)
delete[] old_data;
if(old_flags)
delete[] old_flags;
delete[] old_data;
delete[] old_flags;

//dstream<<"addArea done"<<std::endl;
}
Expand Down

0 comments on commit ae2721f

Please sign in to comment.