Use anonymous function in Linker::formatAutocomments/formatLinksInComment

A anonym function has no own scope, so it is not possible to call the
private callback, so moved the code of the callback into the function.

This avoids passing parameters with static variables to the callback.

Change-Id: I41ad85545301f6699817135b7e8ceba0f8b26851