Get rid of some unnecessary temporary buffers

This commit is contained in:
Alexander 'z33ky' Hirsch 2020-02-26 16:04:20 +01:00
parent d72d817eac
commit 2c60bd368d
3 changed files with 3 additions and 19 deletions

View File

@ -4258,17 +4258,8 @@ bool CBaseEntity::AcceptInput( const char *szInputName, CBaseEntity *pActivator,
{ {
// found a match // found a match
char szBuffer[256];
// mapper debug message // mapper debug message
if (pCaller != NULL) DevMsg( 2, "(%0.2f) input %s: %s.%s(%s)\n", gpGlobals->curtime, pCaller ? STRING(pCaller->m_iName.Get()) : "<NULL>", GetDebugName(), szInputName, Value.String() );
{
Q_snprintf( szBuffer, sizeof(szBuffer), "(%0.2f) input %s: %s.%s(%s)\n", gpGlobals->curtime, STRING(pCaller->m_iName.Get()), GetDebugName(), szInputName, Value.String() );
}
else
{
Q_snprintf( szBuffer, sizeof(szBuffer), "(%0.2f) input <NULL>: %s.%s(%s)\n", gpGlobals->curtime, GetDebugName(), szInputName, Value.String() );
}
DevMsg( 2, "%s", szBuffer );
ADD_DEBUG_HISTORY( HISTORY_ENTITY_IO, szBuffer ); ADD_DEBUG_HISTORY( HISTORY_ENTITY_IO, szBuffer );
if (m_debugOverlays & OVERLAY_MESSAGE_BIT) if (m_debugOverlays & OVERLAY_MESSAGE_BIT)

View File

@ -1103,9 +1103,7 @@ bool g_bCheckForChainedActivate;
{ \ { \
if ( bCheck ) \ if ( bCheck ) \
{ \ { \
char msg[ 1024 ]; \ AssertMsg( g_bReceivedChainedActivate == true, "Entity (%i/%s/%s) failed to call base class Activate()\n", pClass->entindex(), pClass->GetClassname(), STRING( pClass->GetEntityName() ) ); \
Q_snprintf( msg, sizeof( msg ), "Entity (%i/%s/%s) failed to call base class Activate()\n", pClass->entindex(), pClass->GetClassname(), STRING( pClass->GetEntityName() ) ); \
AssertMsg( g_bReceivedChainedActivate == true, msg ); \
} \ } \
g_bCheckForChainedActivate = false; \ g_bCheckForChainedActivate = false; \
} }

View File

@ -57,12 +57,7 @@ void DBG_AssertFunction( bool fExpr, const char *szExpr, const char *szFile, int
{ {
if (fExpr) if (fExpr)
return; return;
char szOut[512]; Warning("ASSERT FAILED:\n %s \n(%s@%d)\n%s", szExpr, szFile, szLine, szMessage ? szMessage : "");
if (szMessage != NULL)
Q_snprintf(szOut,sizeof(szOut), "ASSERT FAILED:\n %s \n(%s@%d)\n%s", szExpr, szFile, szLine, szMessage);
else
Q_snprintf(szOut,sizeof(szOut), "ASSERT FAILED:\n %s \n(%s@%d)\n", szExpr, szFile, szLine);
Warning( szOut);
} }
#endif // DEBUG #endif // DEBUG