Use strlen instead of pointer walking in the rest of places.

This commit is contained in:
Bartosz Taudul 2024-06-16 18:20:16 +02:00
parent 9f0f3a7218
commit be40c1e38e
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 3 additions and 6 deletions

View File

@ -901,8 +901,7 @@ char* NormalizePath( const char* path )
if( path[0] != '/' ) return nullptr; if( path[0] != '/' ) return nullptr;
const char* ptr = path; const char* ptr = path;
const char* end = path; const char* end = path + strlen( path );
while( *end ) end++;
char* res = (char*)tracy_malloc( end - ptr + 1 ); char* res = (char*)tracy_malloc( end - ptr + 1 );
size_t rsz = 0; size_t rsz = 0;

View File

@ -3638,14 +3638,12 @@ void Worker::AddSourceLocationPayload( const char* data, size_t sz )
memcpy( &color, data, 4 ); memcpy( &color, data, 4 );
memcpy( &line, data + 4, 4 ); memcpy( &line, data + 4, 4 );
data += 8; data += 8;
auto end = data; auto end = data + strlen( data );
while( *end ) end++;
const auto func = StoreString( data, end - data ); const auto func = StoreString( data, end - data );
end++; end++;
data = end; data = end + strlen( data );
while( *end ) end++;
const auto source = StoreString( data, end - data ); const auto source = StoreString( data, end - data );
end++; end++;