Partial conversion of buffer.c to ANSI functions.

I'm commiting this in two parts so that Travis and/or other people can
point out any mistakes I made. :smiley: