diff options
author | Tim Jenssen <tim.jenssen@qt.io> | 2016-09-23 15:46:41 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@qt.io> | 2016-09-23 14:27:01 +0000 |
commit | d915b22db9a3e66a2faa045251f7df2146dd428e (patch) | |
tree | 726fc40b312c0e86c4a6469f064d7e3b9fcac78c /src/plugins/git/githighlighters.cpp | |
parent | 669d04a686418541f83a1936d4b278721ec986fe (diff) |
improve static initializers
Change-Id: I304fdd6627f01fc216c84930da607127c52409d9
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/git/githighlighters.cpp')
-rw-r--r-- | src/plugins/git/githighlighters.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/plugins/git/githighlighters.cpp b/src/plugins/git/githighlighters.cpp index b86efdc6e4..4cbb635137 100644 --- a/src/plugins/git/githighlighters.cpp +++ b/src/plugins/git/githighlighters.cpp @@ -37,9 +37,7 @@ static const char CHANGE_PATTERN[] = "\\b[a-f0-9]{7,40}\\b"; GitSubmitHighlighter::GitSubmitHighlighter(QTextEdit * parent) : TextEditor::SyntaxHighlighter(parent) { - static QVector<TextEditor::TextStyle> categories; - if (categories.isEmpty()) - categories << TextEditor::C_COMMENT; + static const QVector<TextEditor::TextStyle> categories({TextEditor::C_COMMENT}); setTextFormatCategories(categories); m_keywordPattern.setPattern("^[\\w-]+:"); @@ -98,18 +96,17 @@ GitRebaseHighlighter::GitRebaseHighlighter(QTextDocument *parent) : m_hashChar('#'), m_changeNumberPattern(CHANGE_PATTERN) { - static QVector<TextEditor::TextStyle> categories; - if (categories.isEmpty()) { - categories << TextEditor::C_COMMENT - << TextEditor::C_DOXYGEN_COMMENT - << TextEditor::C_STRING - << TextEditor::C_KEYWORD - << TextEditor::C_FIELD - << TextEditor::C_TYPE - << TextEditor::C_ENUMERATION - << TextEditor::C_NUMBER - << TextEditor::C_LABEL; - } + static const QVector<TextEditor::TextStyle> categories({ + TextEditor::C_COMMENT, + TextEditor::C_DOXYGEN_COMMENT, + TextEditor::C_STRING, + TextEditor::C_KEYWORD, + TextEditor::C_FIELD, + TextEditor::C_TYPE, + TextEditor::C_ENUMERATION, + TextEditor::C_NUMBER, + TextEditor::C_LABEL + }); setTextFormatCategories(categories); m_actions << RebaseAction("^(p|pick)\\b", Format_Pick); |