Replace redundant yread() with read_in_full() in fast-import.
Prior to git having read_in_full() fast-import used its own private function yread to perform the header reading task. No sense in keeping that around now that read_in_full is a public, stable function. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Jan 16, 2007 at 00:35 UTC
6cf092619376f5bf60987f146d142497ded2f718
1 file changed
+2
-14
fast-import.c
+2
-14
@@ -590,19 +590,6 @@ static void release_tree_entry(struct tree_entry *e)
590
avail_tree_entry = e;
591
}
592
593
-static void yread(int fd, void *buffer, size_t length)
594
-{
595
- ssize_t ret = 0;
596
- while (ret < length) {
597
- ssize_t size = xread(fd, (char *) buffer + ret, length - ret);
598
- if (!size)
599
- die("Read from descriptor %i: end of stream", fd);
600
- if (size < 0)
601
- die("Read from descriptor %i: %s", fd, strerror(errno));
602
- ret += size;
603
- }
604
-}
605
-
593
static void start_packfile()
594
{
595
struct packed_git *p;
@@ -642,7 +629,8 @@ static void fixup_header_footer()
629
die("Failed seeking to start: %s", strerror(errno));
630
631
SHA1_Init(&c);
645
- yread(pack_fd, hdr, 8);
632
+ if (read_in_full(pack_fd, hdr, 8) != 8)
633
+ die("Unable to reread header of %s", pack_data->pack_name);
634
SHA1_Update(&c, hdr, 8);
635
636
cnt = htonl(object_count);