D19766: Improve performance of cliplugins

Rolf Eike Beer noreply at phabricator.kde.org
Mon Mar 18 20:09:07 GMT 2019


dakon added inline comments.

INLINE COMMENTS

> cliinterface.cpp:781
>  
> -    bool wrongPasswordMessage = m_cliProps->isWrongPasswordMsg(QLatin1String(lines.last()));
> +    bool wrongPasswordMessage = isWrongPasswordMsg(QLatin1String(lines.last()));
>  

constLast(), not sure if you really save a lot if you additionally do the conversion to QLatin1String only once, but since you need it at multiple places it's likely no overhead to do so anyway.

> cliinterface.cpp:815
>  
>      foreach(const QByteArray& line, lines) {
>          if (!line.isEmpty() || (m_listEmptyLines && m_operationMode == List)) {

qAsConst to avoid detaching

> cliinterface.cpp:964
> +    if (isFileExistsFileName(line)) {
> +        foreach (const QString &pattern, m_cliProps->property("fileExistsFileNameRegExp").toStringList()) {
> +            const QRegularExpression rxFileNamePattern(pattern);

range based for? Don't forget to put the list in a (const) variable to avoid that the iterators point to an already destroyed temporary.

REPOSITORY
  R36 Ark

REVISION DETAIL
  https://phabricator.kde.org/D19766

To: rthomsen, elvisangelaccio
Cc: dakon, kde-utils-devel, #ark, tctara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-utils-devel/attachments/20190318/140b8dbc/attachment-0001.html>


More information about the Kde-utils-devel mailing list