Repository: unify definitionsFor*() and optimize definitionFor*()
The definitionsFor*() functions are not used anywhere. Yet, the actually used definitionFor*() functions were implemented in terms of these unused ones, which adversely affected their performance.
See the commit messages for details.