2021-10-22 19:53:46 +00:00
|
|
|
#ifndef __TRACYSTRINGHELPERS_HPP__
|
|
|
|
#define __TRACYSTRINGHELPERS_HPP__
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "../common/TracyAlloc.hpp"
|
2022-07-19 23:04:59 +00:00
|
|
|
#include "../common/TracyForceInline.hpp"
|
2021-10-22 19:53:46 +00:00
|
|
|
|
|
|
|
namespace tracy
|
|
|
|
{
|
|
|
|
|
2022-07-19 23:04:59 +00:00
|
|
|
static tracy_force_inline char* CopyString( const char* src, size_t sz )
|
2021-10-22 19:53:46 +00:00
|
|
|
{
|
|
|
|
auto dst = (char*)tracy_malloc( sz + 1 );
|
|
|
|
memcpy( dst, src, sz );
|
|
|
|
dst[sz] = '\0';
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
2022-07-19 23:04:59 +00:00
|
|
|
static tracy_force_inline char* CopyString( const char* src )
|
2021-10-22 19:53:46 +00:00
|
|
|
{
|
|
|
|
const auto sz = strlen( src );
|
|
|
|
auto dst = (char*)tracy_malloc( sz + 1 );
|
|
|
|
memcpy( dst, src, sz );
|
|
|
|
dst[sz] = '\0';
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
2022-07-19 23:04:59 +00:00
|
|
|
static tracy_force_inline char* CopyStringFast( const char* src, size_t sz )
|
2021-10-22 19:53:46 +00:00
|
|
|
{
|
|
|
|
auto dst = (char*)tracy_malloc_fast( sz + 1 );
|
|
|
|
memcpy( dst, src, sz );
|
|
|
|
dst[sz] = '\0';
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
2022-07-19 23:04:59 +00:00
|
|
|
static tracy_force_inline char* CopyStringFast( const char* src )
|
2021-10-22 19:53:46 +00:00
|
|
|
{
|
|
|
|
const auto sz = strlen( src );
|
|
|
|
auto dst = (char*)tracy_malloc_fast( sz + 1 );
|
|
|
|
memcpy( dst, src, sz );
|
|
|
|
dst[sz] = '\0';
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|