ecbuf: Fix bug in operator evaluation order assumption in _push()

The + operator is not a sequence point, so my
(function_that_modifies_a() + a) trick isn't portable after all. I've
decided to stick with 'typeof' for now.
ecbuf: Fix write-after-buffer bug in _push()

And added a minor optimization to avoid a realloc() when the write
pointer is allowed to wrap to the 0 index. (b would be set to cn-1, but
in that case we might as well just increase cn and not set b)

Unfortunately, this makes the _push() function a bit larger than I'd
like it to be. :-(