Fix this code to follow the coding style regarding anonymous namespaces and
static functions. Make a bunch of file-local functions static. Remove one
unused static function revealed by this.