Move various initializations into new "globals.c" file. Also mark some variables static, and fix up some trivial compiler and sparse warnings.