block_Realloc: optimize and conformize
* Shrink the buffer in either direction before reallocating, so we don't need to copy discarded data. (* Special case if the payload is entirely discarded.) * Avoid potentially overflowing pointer comparisons (In real life, it works, but it is not defined by the C specification).
Showing with 65 additions and 24 deletions