From 4d197ec7a2bb59a9e56c0e26f1fe78602f078c7a Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 23 Jun 2018 02:16:58 +0200 Subject: [PATCH] Unsafe version of AppendData. --- client/TracyProfiler.cpp | 3 +-- client/TracyProfiler.hpp | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index c06c68f8..04375342 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -456,8 +456,7 @@ bool Profiler::AppendData( const void* data, size_t len ) { auto ret = true; ret = NeedDataSize( len ); - memcpy( m_buffer + m_bufferOffset, data, len ); - m_bufferOffset += int( len ); + AppendDataUnsafe( data, len ); return ret; } diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index 6643f2ee..a589ae72 100644 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -279,6 +279,12 @@ private: bool CommitData(); bool NeedDataSize( size_t len ); + tracy_force_inline void AppendDataUnsafe( const void* data, size_t len ) + { + memcpy( m_buffer + m_bufferOffset, data, len ); + m_bufferOffset += int( len ); + } + bool SendData( const char* data, size_t len ); void SendString( uint64_t ptr, const char* str, QueueType type ); void SendSourceLocation( uint64_t ptr );