This is the final draft proposed patch
Here are the diffs since the last patch:
The biggest change is to use DataList instead of a linked list for the
idlistscanlimit info structures.
Testing with valgrind revealed a couple of memory leaks which have been
Some formatting has been improved.
Error messages have been improved/fixed.