Port QRegExp to QRegularExpression
ClosedPublic

Authored by ahmadsamir on Dec 20 2019, 9:12 AM.

Details

Test Plan

The code compiles and all unit tests pass, except for five ones, but
they fail on master too.

Note that for \x escape sequences have more than two hex digits, the
pattern must be wrapped in curly braces, i.e. \x{nnnn}, see:
https://perldoc.perl.org/perlre.html

Diff Detail

Repository
R172 KCalendar Core
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.Dec 20 2019, 9:12 AM
Restricted Application added a project: KDE PIM. · View Herald TranscriptDec 20 2019, 9:12 AM
ahmadsamir requested review of this revision.Dec 20 2019, 9:12 AM
ahmadsamir updated this revision to Diff 71947.Dec 21 2019, 2:14 PM

\xnn can be used with one or two hex digits, for \x escape sequences with more than two hex digits one must use \x{nnnn}

gjditchfield added inline comments.Dec 21 2019, 8:39 PM
src/compat.cpp
57

If I understand correctly, this creates a QRegularExpression, compiles the pattern, performs the match, then throws the object and compiled pattern away. Should this declare a constant, so construction and pattern compilation only happen once?

ahmadsamir added inline comments.Dec 22 2019, 7:51 AM
src/compat.cpp
57

hmm, tbh I am not sure whether that would be beneficial or not; it depends on how many times createCompat() is called, looking at the code it's only called by ICalFormatImpl::populate(), but I don't know how many external users do call that function.

vkrause added inline comments.Dec 22 2019, 8:23 AM
src/compat.cpp
57

Right, it's probably not worth it in this case. I don't think this is a particularly hot path, and making it static has a cost too (non-sharable runtime memory).

ahmadsamir updated this revision to Diff 71993.Dec 22 2019, 2:24 PM

Link to KF6 task

ahmadsamir updated this revision to Diff 71998.Dec 22 2019, 2:30 PM
ahmadsamir edited the test plan for this revision. (Show Details)
ahmadsamir removed a subscriber: gjditchfield.

verbatim

ahmadsamir updated this revision to Diff 73994.Jan 21 2020, 8:32 AM

Rebase and tweak the commit message

vkrause accepted this revision.Feb 8 2020, 6:14 PM
This revision is now accepted and ready to land.Feb 8 2020, 6:14 PM
This revision was automatically updated to reflect the committed changes.