[chmodjob] Port away from QLinkedList
Needs ReviewPublic

Authored by nicolasfella on Thu, Nov 21, 4:35 PM.

Details

Reviewers
None
Group Reviewers
Frameworks
Maniphest Tasks
T12087: Port away from QLinkedList
Summary

QLinkedList is likely to go away in Qt 6. A comment suggests that a linkedlist is preferred here, so use std::list instead.

Test Plan

Changed file permissions in Dolphin, verified with ls -l

Diff Detail

Repository
R241 KIO
Branch
ll
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 19048
Build 19066: arc lint + arc unit
nicolasfella created this revision.Thu, Nov 21, 4:35 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptThu, Nov 21, 4:35 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
nicolasfella requested review of this revision.Thu, Nov 21, 4:35 PM

While the change should be fine as is, that sounds like a job for std::deque, as we don't need insertions/removals at random positions. Or even for a std::queue, because we only operate on the front.

bruns added a subscriber: bruns.Thu, Nov 21, 8:05 PM

Or just change the direction?

src/core/chmodjob.cpp
115

For efficiency, probably do a
m_infos.reserve(m_infos.capacity() + m_lstItems.size());
here.

155

For efficiency, probably do a
m_infos.reserve(m_infos.capacity() + list.size());
here.

dfaure added a subscriber: dfaure.Thu, Nov 21, 10:01 PM
dfaure added inline comments.
src/core/chmodjob.cpp
131

This could even be push_front(std::move(info)) since info isn't used anymore afterwards;

190

same here

224

same here

nicolasfella marked 3 inline comments as done.Fri, Nov 22, 8:45 AM
nicolasfella added inline comments.
src/core/chmodjob.cpp
115

Does that make sense with a linked list?

Indeed there's no reserve for std::list.

And std::queue is FIFO, not LIFO.

std::stack would be a more appropriate container here.

  • Use stack