[pim/trojita] src/Imap: Move static global QRegularExpression into method

Espen Sandøy Hustad <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit a73ea60b81e2f8247ec342fa70eac12874a0f7cc by Espen Sandøy Hustad.
Committed on 09/08/2026 at 11:05.
Pushed by ehustad into branch 'master'.

Move static global QRegularExpression into method

This is only used inside one method, move it there and make it const.

Fix Clazy warning:
- src/Imap/Encoders.cpp:522:1: warning: non-POD static
(QRegularExpressionImap::atomPhraseRx) [-Wclazy-non-pod-global-static]

M  +1    -1    src/Imap/Encoders.cpp

https://invent.kde.org/pim/trojita/-/commit/a73ea60b81e2f8247ec342fa70eac12874a0f7cc

diff --git a/src/Imap/Encoders.cpp b/src/Imap/Encoders.cpp
index 916f4d8d1..e4bb57eaf 100644
--- a/src/Imap/Encoders.cpp
+++ b/src/Imap/Encoders.cpp
@@ -519,9 +519,9 @@ QByteArray quotedString( const QByteArray& unquoted, QuotedStringStyle style )
    byte-sequence for use in a "structured" mail header (such as To:,
    From:, or Received:). The result will match the "phrase"
    production. */
-static QRegularExpression atomPhraseRx(QLatin1String("^[ \\tA-Za-z0-9!#$&'*+/=?^_`{}|~-]*$"));
 QByteArray encodeRFC2047Phrase(const QString &text)
 {
+    static const QRegularExpression atomPhraseRx(QLatin1String("^[ \\tA-Za-z0-9!#$&'*+/=?^_`{}|~-]*$"));
     /* We want to know if we can encode as ASCII. But bizarrely, Qt
        (on my system at least) doesn't have an ASCII codec. So we use
        the ISO-8859-1 superset, and check for any non-ASCII characters
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.