git-tar-tree: cleanup trailer writing
PATCH 1/1 git-tar-tree: cleanup trailer writing
Replace open-coded variants of get_record().
Signed-off-by Rene Scharfe <[email protected]>
tar-tree.c (mode:100644) +5 -8
@@ -73,16 +73,13 @@ */ static void write_trailer(void) { - memset(block + offset, 0, RECORDSIZE); - offset += RECORDSIZE; + get_record(); write_if_needed(); - memset(block + offset, 0, RECORDSIZE); - offset += RECORDSIZE; + get_record(); write_if_needed(); - if (offset) { - memset(block + offset, 0, BLOCKSIZE - offset); - reliable_write(block, BLOCKSIZE); - offset = 0; + while (offset) { + get_record(); + write_if_needed(); } }