mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 10:15:38 +08:00
Made value object regular expressions thread safe
(note: which is important because the RegEx is static)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f8c83ce2a3
commit
e3b0720295
@@ -106,8 +106,11 @@ namespace BlackMisc
|
||||
|
||||
bool CAirlineIcaoCode::isValidAirlineDesignator(const QString &airline)
|
||||
{
|
||||
static QRegularExpression regexp("^[A-Z]+[A-Z0-9]*$");
|
||||
if (airline.length() < 2 || airline.length() > 5) return false;
|
||||
|
||||
static QThreadStorage<QRegularExpression> tsRegex;
|
||||
if (! tsRegex.hasLocalData()) { tsRegex.setLocalData(QRegularExpression("^[A-Z]+[A-Z0-9]*$")); }
|
||||
const QRegularExpression ®exp = tsRegex.localData();
|
||||
return (regexp.match(airline).hasMatch());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user