cleanup of linkage processing code, part 3

Last and final bits of the linkage-processing cleanup.  This includes a fix that would make link-grammar crash in multi-threaded mode.