mirror of
https://github.com/wolfpld/tracy.git
synced 2026-06-08 08:33:48 +00:00
Do not mix loading file data with regex validation.
This commit is contained in:
@@ -243,10 +243,9 @@ void UserData::SaveAnnotations( const std::vector<std::unique_ptr<Annotation>>&
|
||||
}
|
||||
}
|
||||
|
||||
bool UserData::LoadSourceSubstitutions( std::vector<SourceRegex>& data )
|
||||
void UserData::LoadSourceSubstitutions( std::vector<SourceRegex>& data )
|
||||
{
|
||||
assert( Valid() );
|
||||
bool regexValid = true;
|
||||
FILE* f = OpenFile( FileSourceSubstitutions, false );
|
||||
if( f )
|
||||
{
|
||||
@@ -276,21 +275,11 @@ bool UserData::LoadSourceSubstitutions( std::vector<SourceRegex>& data )
|
||||
fread( buf, 1, tsz, f );
|
||||
target.assign( buf, tsz );
|
||||
}
|
||||
std::regex regex;
|
||||
try
|
||||
{
|
||||
regex.assign( pattern );
|
||||
}
|
||||
catch( std::regex_error& )
|
||||
{
|
||||
regexValid = false;
|
||||
}
|
||||
data.emplace_back( SourceRegex { std::move( pattern ), std::move( target ), std::move( regex ) } );
|
||||
data.emplace_back( SourceRegex { std::move( pattern ), std::move( target ) } );
|
||||
}
|
||||
}
|
||||
fclose( f );
|
||||
}
|
||||
return regexValid;
|
||||
}
|
||||
|
||||
void UserData::SaveSourceSubstitutions( const std::vector<SourceRegex>& data )
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
void LoadAnnotations( std::vector<std::unique_ptr<Annotation>>& data );
|
||||
void SaveAnnotations( const std::vector<std::unique_ptr<Annotation>>& data );
|
||||
|
||||
bool LoadSourceSubstitutions( std::vector<SourceRegex>& data );
|
||||
void LoadSourceSubstitutions( std::vector<SourceRegex>& data );
|
||||
void SaveSourceSubstitutions( const std::vector<SourceRegex>& data );
|
||||
|
||||
const char* GetConfigLocation() const;
|
||||
|
||||
@@ -104,7 +104,8 @@ View::View( void(*cbMainThread)(const std::function<void()>&, bool), FileRead& f
|
||||
m_userData.StateShouldBePreserved();
|
||||
m_userData.LoadState( m_vd );
|
||||
m_userData.LoadAnnotations( m_annotations );
|
||||
m_sourceRegexValid = m_userData.LoadSourceSubstitutions( m_sourceSubstitutions );
|
||||
m_userData.LoadSourceSubstitutions( m_sourceSubstitutions );
|
||||
ValidateSourceRegex();
|
||||
|
||||
if( m_worker.GetCallstackSampleCount() == 0 ) m_showAllSymbols = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user