block_Realloc: optimize and conformize
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 30 Aug 2009 10:58:50 +0000 (13:58 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 30 Aug 2009 11:03:27 +0000 (14:03 +0300)
commit23510de81a86cb42a203ca9b82992857155a4cd9
treecf29843a68b5646657964a899c8e793d468a0544
parent8152b0d8befba6a40500c997f3fd917ebdde4df2
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).
src/misc/block.c