Avoid executing strlen() twice in assert-enabled builds.

This commit is contained in:
Bartosz Taudul 2020-05-10 14:24:18 +02:00
parent 507b5e3a46
commit 91bb392678

View File

@ -44,7 +44,11 @@ static inline char* CopyString( const char* src, size_t sz )
static inline char* CopyString( const char* src ) static inline char* CopyString( const char* src )
{ {
return CopyString( src, strlen( src ) ); const auto sz = strlen( src );
auto dst = (char*)tracy_malloc( sz + 1 );
memcpy( dst, src, sz );
dst[sz] = '\0';
return dst;
} }