do not pretend sha1write returns errors

The sha1write function returns an int, but it will always be
"0". The failure-prone parts of the function happen in the
"flush" callback, which cannot pass an error back to us. So
we just end up calling die() during the flush.

Let's just drop the return value altogether, as it only
confuses callers into thinking that it might be useful.

Only one call site actually checked the return value. We can
drop that check, since it just led to a die() anyway.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King
2013-12-21 09:13:25 -05:00
committed by Junio C Hamano
parent 7794a680e6
commit 9af270e8c2
4 changed files with 3 additions and 7 deletions

View File

@ -86,7 +86,7 @@ int sha1close(struct sha1file *f, unsigned char *result, unsigned int flags)
return fd;
}
int sha1write(struct sha1file *f, void *buf, unsigned int count)
void sha1write(struct sha1file *f, void *buf, unsigned int count)
{
while (count) {
unsigned offset = f->offset;
@ -116,7 +116,6 @@ int sha1write(struct sha1file *f, void *buf, unsigned int count)
}
f->offset = offset;
}
return 0;
}
struct sha1file *sha1fd(int fd, const char *name)