mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-08-03 04:19:20 -04:00
and fix a ton more minor performance issues
This commit is contained in:
+15
-30
@@ -76,25 +76,20 @@ int x;
|
||||
|
||||
for(x=0;x<m_count;x++)
|
||||
{
|
||||
if( m_data[x].discription )
|
||||
delete [] m_data[x].discription;
|
||||
delete [] m_data[x].discription;
|
||||
|
||||
if( m_data[x].label )
|
||||
delete [] m_data[x].label;
|
||||
delete [] m_data[x].label;
|
||||
}
|
||||
|
||||
if(m_buffer)
|
||||
delete m_buffer;
|
||||
delete m_buffer;
|
||||
|
||||
if( m_data )
|
||||
delete [] m_data;
|
||||
delete [] m_data;
|
||||
}
|
||||
|
||||
|
||||
void CMonitorData::setMax(int _max)
|
||||
{
|
||||
if( m_data )
|
||||
delete [] m_data;
|
||||
delete [] m_data;
|
||||
|
||||
m_max = _max;
|
||||
m_data = new MON_ELEMENT[m_max];
|
||||
@@ -411,14 +406,12 @@ int x;
|
||||
m_data[x].id = id;
|
||||
|
||||
//******* Label ***********
|
||||
if( m_data[x].label )
|
||||
delete [] m_data[x].label;
|
||||
delete [] m_data[x].label;
|
||||
m_data[x].label = new char [strlen(label)+1];
|
||||
strcpy(m_data[x].label,label);
|
||||
|
||||
//******* Discription ******
|
||||
if( m_data[x].discription != NULL )
|
||||
delete [] m_data[x].discription;
|
||||
delete [] m_data[x].discription;
|
||||
m_data[x].discription = NULL;
|
||||
if( des )
|
||||
{
|
||||
@@ -444,14 +437,12 @@ int x;
|
||||
m_data[m_count].ping = pingValue( ping );
|
||||
m_data[m_count].value = 0;
|
||||
m_data[m_count].id = id;
|
||||
if(m_data[m_count].label)
|
||||
delete [] m_data[m_count].label;
|
||||
delete [] m_data[m_count].label;
|
||||
m_data[m_count].label = new char [strlen(label)+1];
|
||||
strcpy(m_data[m_count].label,label);
|
||||
if( des )
|
||||
{
|
||||
if( m_data[x].discription )
|
||||
delete [] m_data[x].discription;
|
||||
delete [] m_data[x].discription;
|
||||
m_data[x].discription = new char [strlen(des)+1];
|
||||
strcpy(m_data[x].discription,des);
|
||||
}
|
||||
@@ -470,8 +461,7 @@ int x;
|
||||
{
|
||||
if( Description == NULL )
|
||||
{
|
||||
if( m_data[x].discription )
|
||||
delete [] m_data[x].discription;
|
||||
delete [] m_data[x].discription;
|
||||
m_data[x].discription = NULL;
|
||||
mode = 0;
|
||||
return x;
|
||||
@@ -479,8 +469,7 @@ int x;
|
||||
if( m_data[x].discription && !strcmp( m_data[x].discription, Description ) )
|
||||
return -1;
|
||||
|
||||
if( m_data[x].discription )
|
||||
delete [] m_data[x].discription;
|
||||
delete [] m_data[x].discription;
|
||||
m_data[x].discription = new char [ strlen(Description) +1 ];
|
||||
strcpy(m_data[x].discription,Description);
|
||||
mode = 1;
|
||||
@@ -533,11 +522,9 @@ int x;
|
||||
|
||||
if( m_count == 1 )
|
||||
{
|
||||
if( m_data[0].label )
|
||||
delete [] m_data[0].label;
|
||||
delete [] m_data[0].label;
|
||||
|
||||
if( m_data[0].discription )
|
||||
delete [] m_data[0].discription;
|
||||
delete [] m_data[0].discription;
|
||||
|
||||
|
||||
m_data[0].label = 0;
|
||||
@@ -552,11 +539,9 @@ int x;
|
||||
{
|
||||
if( Id == m_data[x].id )
|
||||
{
|
||||
if( m_data[x].label )
|
||||
delete [] m_data[x].label;
|
||||
delete [] m_data[x].label;
|
||||
|
||||
if( m_data[x].discription )
|
||||
delete [] m_data[x].discription;
|
||||
delete [] m_data[x].discription;
|
||||
|
||||
m_data[x].label = 0;
|
||||
if( x < m_count-1 )
|
||||
|
||||
Reference in New Issue
Block a user