Add function prototypes and return types. Instead of #define foo #undef foo for every function, just use local variables. Some KNF.