Redmine/6553: Fix implicit looping over multiple lists

Pull request for initial review of the changes to the code. Planning to add more test coverage to the acceptance test before merging.
I see this defined here and used only in expand.c; I don't see a prior definition of this function being removed; so 
* Where is the declaration in a header, that expand.c can see ?
* Why isn't this simply (a static) in expand.c, if that's the only caller ?
If there already exists a function called NullIterators, I have to suppose this is a duplicate symbol.
But, presumably, everything compiled for you, so I must be missing something.