Optimize replace_chunk() for replacements at the end of the block
commit3d5caefda4339e3738b3feadfbfe79f2f74e8138
authorPetr Tesarik <petr@tesarici.cz>
Fri, 18 May 2018 09:52:01 +0000 (18 11:52 +0200)
committerPetr Tesarik <petr@tesarici.cz>
Fri, 18 May 2018 09:52:01 +0000 (18 11:52 +0200)
tree22f3ccefd74f6c9c9fb0bbcfd5dd684910ff0f45
parent5c05850c2a5f3ca68be6929c1cfe9f982e9911e9
Optimize replace_chunk() for replacements at the end of the block

If the new block replaces the tail of the original block,
replace_chunk() currently splits the block, moves some pointers to
the newly allocated head block, moves the remaining pointers to the
new block, shrinks the original block to zero and kills it.

In this case, it is better to shrink the original block and the new
block after it.

Signed-off-by: Petr Tesarik <petr@tesarici.cz>
libhed/file.c