Use a for loop instead of foreach
Summary:
Krazy was complaining about the missing const ref (added in the
process), but there's no good reason to keep using foreach now.
Reviewers: Zanshin, dfaure, bensi, franckarrecot
Differential Revision: https://phabricator.kde.org/D5836