Skip to content

Commit

Permalink
clazy: Combine multiple calls to QString::arg in mythnews.
Browse files Browse the repository at this point in the history
Each call to QString::arg causes the Qt libraries to scan the string
to find the lowest numbered place marker, and it causes a memory
allocate to store the resulting integrated string. Consecutive calls
to ::arg with string arguments can be combined into a single call,
thus reducing the number of required string scans and (more
importantly) memory allocations.
  • Loading branch information
linuxdude42 committed Apr 22, 2021
1 parent 2939645 commit e26e39d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mythplugins/mythnews/mythnews/mythnewsconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void MythNewsConfig::populateSites(void)
QMutexLocker locker(&m_lock);

QString filename = QString("%1%2")
.arg(GetShareDir()).arg("mythnews/news-sites.xml");
.arg(GetShareDir(), "mythnews/news-sites.xml");

QFile xmlFile(filename);

Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythnews/mythnews/newssite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void NewsSite::retrieve(void)
m_errorString.clear();
m_updateErrorString.clear();
m_articleList.clear();
QString destFile = QString("%1/%2").arg(m_destDir).arg(m_name);
QString destFile = QString("%1/%2").arg(m_destDir, m_name);
GetMythDownloadManager()->queueDownload(m_url, destFile, this, true);
}

Expand Down Expand Up @@ -442,7 +442,7 @@ void NewsSite::parseRSS(const QDomDocument& domDoc)

LOG(VB_GENERAL, LOG_DEBUG,
QString("parseRSS found media:content: medium: %1, type: %2, url: %3")
.arg(medium).arg(type).arg(url2));
.arg(medium, type, url2));

// if this is an image use it as the thumbnail if we haven't found one yet
if (thumbnail.isEmpty() && (medium == "image" || isImage(type)))
Expand Down

0 comments on commit e26e39d

Please sign in to comment.