Make use of preprocessor macros for static known_dirs.c functions

Preprocessor macros are used to expand the static functions in `known_dirs.c`, and since they are restricted to the implementation, I believe this not to be preprocessor abuse. Overall readability goes up IMHO, repetition goes down, and no grepability is lost.

Cherry-picked from another one of my endeavors... love it or hate it?