ENH: Improve performance by compiling regular expressions when needed

This commit is contained in:
Andy Cedilnik 2005-07-02 22:31:30 -04:00
parent e712c7c05e
commit bd44dc14fe
1 changed files with 18 additions and 35 deletions

View File

@ -167,23 +167,6 @@ cmCTestBuildHandler::cmCTestBuildHandler()
m_LastErrorOrWarning = m_ErrorsAndWarnings.end(); m_LastErrorOrWarning = m_ErrorsAndWarnings.end();
int cc;
for ( cc = 0; cmCTestWarningErrorFileLine[cc].m_RegularExpressionString; ++ cc )
{
cmCTestBuildHandler::cmCTestCompileErrorWarningRex r;
if ( r.m_RegularExpression.compile(
cmCTestWarningErrorFileLine[cc].m_RegularExpressionString) )
{
r.m_FileIndex = cmCTestWarningErrorFileLine[cc].m_FileIndex;
r.m_LineIndex = cmCTestWarningErrorFileLine[cc].m_LineIndex;
m_ErrorWarningFileLineRegex.push_back(r);
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem Compiling regular expression: "
<< cmCTestWarningErrorFileLine[cc].m_RegularExpressionString << std::endl);
}
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -226,24 +209,6 @@ void cmCTestBuildHandler::Initialize()
m_MaxErrors = 50; m_MaxErrors = 50;
m_MaxWarnings = 50; m_MaxWarnings = 50;
int cc;
for ( cc = 0; cmCTestWarningErrorFileLine[cc].m_RegularExpressionString; ++ cc )
{
cmCTestBuildHandler::cmCTestCompileErrorWarningRex r;
if ( r.m_RegularExpression.compile(
cmCTestWarningErrorFileLine[cc].m_RegularExpressionString) )
{
r.m_FileIndex = cmCTestWarningErrorFileLine[cc].m_FileIndex;
r.m_LineIndex = cmCTestWarningErrorFileLine[cc].m_LineIndex;
m_ErrorWarningFileLineRegex.push_back(r);
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem Compiling regular expression: "
<< cmCTestWarningErrorFileLine[cc].m_RegularExpressionString << std::endl);
}
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -266,6 +231,24 @@ int cmCTestBuildHandler::ProcessHandler()
{ {
cmCTestLog(m_CTest, HANDLER_OUTPUT, "Build project" << std::endl); cmCTestLog(m_CTest, HANDLER_OUTPUT, "Build project" << std::endl);
int entry;
for ( entry = 0; cmCTestWarningErrorFileLine[entry].m_RegularExpressionString; ++ entry )
{
cmCTestBuildHandler::cmCTestCompileErrorWarningRex r;
if ( r.m_RegularExpression.compile(
cmCTestWarningErrorFileLine[entry].m_RegularExpressionString) )
{
r.m_FileIndex = cmCTestWarningErrorFileLine[entry].m_FileIndex;
r.m_LineIndex = cmCTestWarningErrorFileLine[entry].m_LineIndex;
m_ErrorWarningFileLineRegex.push_back(r);
}
else
{
cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem Compiling regular expression: "
<< cmCTestWarningErrorFileLine[entry].m_RegularExpressionString << std::endl);
}
}
// Determine build command and build directory // Determine build command and build directory
const std::string &makeCommand = m_CTest->GetCTestConfiguration("MakeCommand"); const std::string &makeCommand = m_CTest->GetCTestConfiguration("MakeCommand");
if ( makeCommand.size() == 0 ) if ( makeCommand.size() == 0 )