Generic circular buffer in c, without macros!