From 4ab7ef301ee0d568d69ca703e50f8df1c23807b0 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 17 May 2026 15:03:22 +0200 Subject: [PATCH] Split IsFrameExternalImpl into image + filename parts. --- server/TracyWorker.cpp | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 02527e86..b5e87882 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -8934,23 +8934,25 @@ void Worker::CacheSourceFiles() } } -static bool IsFrameExternalImpl( const char* filename, const char* image ) +static bool IsImageExternalImpl( const char* image ) { - if( image && ( - strncmp( image, "/usr/", 5 ) == 0 || - strncmp( image, "/lib/", 5 ) == 0 || - strncmp( image, "/lib64/", 7 ) == 0 || - strcmp( image, "" ) == 0 - ) ) return true; + assert( image ); + if( strncmp( image, "/usr/", 5 ) == 0 ) return true; + if( strncmp( image, "/lib/", 5 ) == 0 ) return true; + if( strncmp( image, "/lib64/", 7 ) == 0 ) return true; + if( strcmp( image, "" ) == 0 ) return true; + return false; +} - if( - strncmp( filename, "/usr/", 5 ) == 0 || - strncmp( filename, "/lib/", 5 ) == 0 || - strcmp( filename, "[unknown]" ) == 0 || - strcmp( filename, "" ) == 0 || - strncmp( filename, "C:\\Program Files", 16 ) == 0 || - strncmp( filename, "d:\\a01\\_work\\", 13 ) == 0 - ) return true; +static bool IsSourceExternalImpl( const char* filename ) +{ + assert( filename ); + if( strncmp( filename, "/usr/", 5 ) == 0 ) return true; + if( strncmp( filename, "/lib/", 5 ) == 0 ) return true; + if( strcmp( filename, "[unknown]" ) == 0 ) return true; + if( strcmp( filename, "" ) == 0 ) return true; + if( strncmp( filename, "C:\\Program Files", 16 ) == 0 ) return true; + if( strncmp( filename, "d:\\a01\\_work\\", 13 ) == 0 ) return true; while( *filename ) { @@ -8961,6 +8963,12 @@ static bool IsFrameExternalImpl( const char* filename, const char* image ) return false; } +static bool IsFrameExternalImpl( const char* filename, const char* image ) +{ + if( image && IsImageExternalImpl( image ) ) return true; + return IsSourceExternalImpl( filename ); +} + bool Worker::IsFrameExternal( StringIdx filename, StringIdx image ) const { return IsFrameExternalImpl( GetString( filename ), image.Active() ? GetString( image ) : nullptr );