From 1b21b880e67f7efcea6c7a36153a43ea8e2d05ff Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 14 Jul 2025 10:25:12 +0100 Subject: [PATCH] Thread safety. --- common/common.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common/common.cpp b/common/common.cpp index a25d0395c6..9bf702b452 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -71,9 +71,8 @@ wxString ExpandTextVars( const wxString& aSource, const PROJECT* aProject, int a wxString ExpandTextVars( const wxString& aSource, const std::function* aResolver, int aFlags ) { - static wxRegEx userDefinedWarningError( wxS( "^(ERC|DRC)_(WARNING|ERROR).*$" ) ); - wxString newbuf; - size_t sourceLen = aSource.length(); + wxString newbuf; + size_t sourceLen = aSource.length(); newbuf.Alloc( sourceLen ); // best guess (improves performance) @@ -94,7 +93,10 @@ wxString ExpandTextVars( const wxString& aSource, if( token.IsEmpty() ) continue; - if( ( aFlags & FOR_ERC_DRC ) == 0 && userDefinedWarningError.Matches( token ) ) + if( ( aFlags & FOR_ERC_DRC ) == 0 && ( token.StartsWith( wxS( "ERC_WARNING" ) ) + || token.StartsWith( wxS( "ERC_ERROR" ) ) + || token.StartsWith( wxS( "DRC_WARNING" ) ) + || token.StartsWith( wxS( "DRC_ERROR" ) ) ) ) { // Only show user-defined warnings/errors during ERC/DRC }