[KCharSelect] Minor code optimisation
ClosedPublic

Authored by ahmadsamir on Apr 21 2020, 3:23 PM.

Details

Summary
  • Replace one last foreach with range-for, and set -DQT_NO_FOREACH
  • More const and static where appropriate
  • If a capture group is not used with QRegularExpression, better make it a clustering/non-capturing group, less book keeping on PCRE side
Test Plan

make && ctest and a quick search in kcharselecttest still works.

Diff Detail

Repository
R236 KWidgetsAddons
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ahmadsamir created this revision.Apr 21 2020, 3:23 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 21 2020, 3:23 PM
ahmadsamir requested review of this revision.Apr 21 2020, 3:23 PM
dfaure requested changes to this revision.Apr 22 2020, 1:16 PM
dfaure added inline comments.
src/kcharselectdata.cpp
870

Shouldn't this be moved to inside the if (match.hasMatch()) check?

This revision now requires changes to proceed.Apr 22 2020, 1:16 PM
ahmadsamir updated this revision to Diff 80886.Apr 22 2020, 1:54 PM

Only use captured() if there's a match

ahmadsamir marked an inline comment as done.Apr 22 2020, 1:55 PM
ahmadsamir added inline comments.
src/kcharselectdata.cpp
870

Indeed.

dfaure accepted this revision.Apr 22 2020, 1:56 PM
This revision is now accepted and ready to land.Apr 22 2020, 1:56 PM
This revision was automatically updated to reflect the committed changes.
ahmadsamir marked an inline comment as done.