QStringList initializer list cleanup
ClosedPublic

Authored by dhaumann on Dec 5 2017, 2:55 PM.

Details

Summary

Simple cleanup of QStringList{...}

Test Plan

make test

Diff Detail

Repository
R39 KTextEditor
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dhaumann created this revision.Dec 5 2017, 2:55 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptDec 5 2017, 2:55 PM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
dhaumann requested review of this revision.Dec 5 2017, 2:55 PM
mwolff added a comment.Dec 5 2017, 3:21 PM

better than before, but some things could be improved some more

src/document/katedocument.cpp
4518

even better would be to not name this list type at all, to use initializer_list and then use STL algorithms on it, but this is already better. The advantage of my suggested pattern is that there is no memory allocation at all anymore.

Compare https://godbolt.org/g/3SvKNw against https://godbolt.org/g/w9ySts (it should be similar for QStrings)

4613

dito

4733

dito

4739

dito

src/script/katescriptmanager.cpp
119

use auto on the left

src/view/kateview.cpp
1385–1402

don't name a type (use initializer list) and then use range-based for below

dhaumann updated this revision to Diff 23518.Dec 5 2017, 4:10 PM

Use initializer_lists directly

@mwolff I have a separate patch where I use STL algos in katedocument. I would like to keep this as separate patch, though. So is this change fine now?

make test still passes.

mwolff accepted this revision.Dec 5 2017, 5:18 PM

yep this is better than before after all

src/view/kateview.cpp
1385–1402

this could still be an initializer list

This revision is now accepted and ready to land.Dec 5 2017, 5:18 PM
This revision was automatically updated to reflect the committed changes.