and fix a ton more minor performance issues

This commit is contained in:
DarthArgus
2014-10-27 22:39:57 -07:00
parent 14eaf713d0
commit c9c39d5713
97 changed files with 266 additions and 376 deletions
@@ -47,8 +47,7 @@ MonitorObject::MonitorObject(UdpConnection *con,CMonitorData *_gamedata, char *p
MonitorObject::~MonitorObject()
{
if( mMark )
delete [] mMark;
delete [] mMark;
if( mConnection )
{
@@ -280,8 +279,7 @@ int x;
while( allowedAddressList[x])
free(allowedAddressList[x++]);
if( passString )
free( passString );
free( passString );
for (int i =0; i < mObjectCount; i++ )
delete mObject[i];
@@ -353,8 +351,7 @@ char buffer[1024];
return false;
}
if( passString )
free(passString);
free(passString);
for(x=0;x<AUTHADDRESS_MAX;x++)
@@ -437,16 +434,13 @@ CMonitorAPI::CMonitorAPI( const char *configFile, unsigned short Port, bool _bpr
CMonitorAPI::~CMonitorAPI()
{
if( mAddress )
free(mAddress);
free(mAddress);
if( mObjectManager )
delete mObjectManager;
delete mObjectManager;
mManager->Release();
if( mMonitorData )
delete mMonitorData;
delete mMonitorData;
}
@@ -530,8 +524,7 @@ monMessage(command, sequence, size)
//----------------------------------------------------------------
stringMessage::~stringMessage()
{
if(data)
delete [] data;
delete [] data;
data = 0;
}
@@ -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 )