Made functions static that should be static.
Ported to ANSI C.