Make halide_rewrite_buffer a static function

The scope of halide_rewrite_buffer is local to the compilation unit, and
when halide_rewrite_buffer is not static it causes a name clash in applications
that compile two C/C++ files generated from Func.compile_to_c