Rework the way trees of MergeEngine objects are built in vdbesort.c to make it easier to follow. Fix memory leaks that could follow an OOM or IO error. Add various comments to explain functions in vdbesort.c.
Change the name of vdbeIncrInit2 to vdbePmaReaderIncrInit. Add a header comment to the same function.
Clarify the purpose of the nField argument passed to sqlite3VdbeSorterInit().
Fix build problems in vdbesort.c. Add further comments and changes to make things easier to understand.