Make it compile without foreach
ClosedPublic

Authored by mlaurent on Feb 25 2019, 12:18 PM.

Details

Summary

compile without foreach

Diff Detail

Repository
R283 KAuth
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mlaurent created this revision.Feb 25 2019, 12:18 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 25 2019, 12:18 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
mlaurent requested review of this revision.Feb 25 2019, 12:18 PM
dfaure accepted this revision.Mar 2 2019, 11:16 PM
dfaure added inline comments.
src/backends/polkit-1/Polkit1Backend.cpp
203–204

(pre-existing) bad, very slow, creates a temp container just to iterate.

for (auto it = m_cachedResults.begin(); it != m_cachedResults.end(); ++it) {
    const QString action = it.key();
    if (it.value() != ....) {
        *it = ....;
         ...
    }
}
This revision is now accepted and ready to land.Mar 2 2019, 11:16 PM
This revision was automatically updated to reflect the committed changes.

FYI, this breaks mac building since there's a foreach in src/backends/mac/kauth-policy-gen-mac.cpp; also a few under src/backends/fake

On Mac, this change gives this error (after removing -DQT_NO_FOREACH) - the recent changes did not fix the error below - f9b835c66a1facfcd6257fe84d3c7e8ead508353 builds fine.

Undefined symbols for architecture x86_64:

"output(QList<Action> const&, QMap<QString, QString> const&)", referenced from:
    _main in policy-gen.cpp.o

ld: symbol(s) not found for architecture x86_64