Bugfix: moved ai_assert condition evaluation out of the assert function to avoid constructing two expensive strings on every single call.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@525 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
c508bafbad
commit
185c30c85b
|
@ -87,7 +87,7 @@ void ValidateDSProcess::ReportError(const char* msg,...)
|
|||
|
||||
va_end(args);
|
||||
#ifdef _DEBUG
|
||||
aiAssert( false,szBuffer,__LINE__,__FILE__ );
|
||||
aiAssert( szBuffer,__LINE__,__FILE__ );
|
||||
#endif
|
||||
throw new ImportErrorException("Validation failed: " + std::string(szBuffer,iLen));
|
||||
}
|
||||
|
|
|
@ -10,9 +10,11 @@
|
|||
|
||||
// Set a breakpoint using win32, else line, file and message will be returned and progam ends with
|
||||
// errrocode = 1
|
||||
void Assimp::aiAssert (bool expression, const std::string &message, unsigned int uiLine, const std::string &file)
|
||||
void Assimp::aiAssert (const std::string &message, unsigned int uiLine, const std::string &file)
|
||||
{
|
||||
if (!expression)
|
||||
// moved expression testing out of the function and into the macro to avoid constructing
|
||||
// two std::string on every single ai_assert test
|
||||
// if (!expression)
|
||||
{
|
||||
// FIX (Aramis): changed std::cerr to std::cout that the message appears in VS' output window ...
|
||||
std::cout << "File :" << file << ", line " << uiLine << " : " << message << std::endl;
|
||||
|
|
|
@ -14,13 +14,13 @@ namespace Assimp {
|
|||
//! \brief ASSIMP specific assertion test, only works in debug mode
|
||||
//! \param uiLine Line in file
|
||||
//! \param file Source file
|
||||
void aiAssert (bool expression, const std::string &message, unsigned int uiLine, const std::string &file);
|
||||
void aiAssert(const std::string &message, unsigned int uiLine, const std::string &file);
|
||||
|
||||
|
||||
//! \def ai_assert
|
||||
//! \brief ASSIM specific assertion test
|
||||
#ifdef DEBUG
|
||||
# define ai_assert(expression) Assimp::aiAssert (expression, #expression, __LINE__, __FILE__);
|
||||
# define ai_assert(expression) if( !(expression)) Assimp::aiAssert( #expression, __LINE__, __FILE__);
|
||||
#else
|
||||
# define ai_assert(expression)
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue