D26131: Braces around for, break early.

Kevin Ottens noreply at phabricator.kde.org
Tue Jan 28 16:13:55 GMT 2020


ervin added a comment.


  Does it apply on top of your refactoring? Also the description looks wrong now.

INLINE COMMENTS

> kconfig_compiler.cpp:179
>  {
> -    bool isAscii = true;
> -    for (int i = s.length(); i--;)
> -        if (s[i].unicode() > 127) {
> -            isAscii = false;
> -        }
> -
> +    bool isAscii = ! std::any_of(std::begin(s), std::end(s), [](QChar a) { return a.unicode() > 127; });
>      if (isAscii) {

Nitpick: there shouldn't be a space after !

Also: use std::cbegin and std::cend (I think they're allowed nowadays)
And: "const QChar &" instead of QChar?

REPOSITORY
  R237 KConfig

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

To: tcanabrava, ervin, dfaure
Cc: ervin, patrickelectric, kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200128/03e96995/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list