Move some useful functions into misc.c
Do compile time checks of literal map values