From 02d216fa135b076f95aa74db9363e96516d3279c Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Sat, 16 May 2020 15:37:47 +0200 Subject: [PATCH] VcsBaseEditor: Reduce scope of local variable As suggested by cppcheck. While at it, make it const. Change-Id: I7800291545f8f14f4d939152d9a184da6eadc1f5 Reviewed-by: Orgad Shaneh --- src/plugins/vcsbase/vcsbaseeditor.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index f94b08ffb10..bed1d5c8632 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -424,11 +424,10 @@ bool UrlTextCursorHandler::findContentsUnderCursor(const QTextCursor &cursor) if (cursorForUrl.hasSelection()) { const QString line = cursorForUrl.selectedText(); const int cursorCol = cursor.columnNumber(); - int urlMatchIndex = -1; QRegularExpressionMatchIterator i = m_pattern.globalMatch(line); while (i.hasNext()) { const QRegularExpressionMatch match = i.next(); - urlMatchIndex = match.capturedStart(); + const int urlMatchIndex = match.capturedStart(); const QString url = match.captured(0); if (urlMatchIndex <= cursorCol && cursorCol <= urlMatchIndex + url.length()) { m_urlData.startColumn = urlMatchIndex;