Remove the use of the old FOREACH macros.

Use native loops whenever possible.
Merge branch 'foreach-cleanup-clean' into sm6