csum-file: introduce hashfile_total()
We will need this helper function in a following commit to give us total number of bytes fed to the hashfile so far. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
8ebf529661
commit
2f4af77699
@ -42,6 +42,15 @@ void hashflush(struct hashfile *f);
|
|||||||
void crc32_begin(struct hashfile *);
|
void crc32_begin(struct hashfile *);
|
||||||
uint32_t crc32_end(struct hashfile *);
|
uint32_t crc32_end(struct hashfile *);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the total number of bytes fed to the hashfile so far (including ones
|
||||||
|
* that have not been written out to the descriptor yet).
|
||||||
|
*/
|
||||||
|
static inline off_t hashfile_total(struct hashfile *f)
|
||||||
|
{
|
||||||
|
return f->total + f->offset;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void hashwrite_u8(struct hashfile *f, uint8_t data)
|
static inline void hashwrite_u8(struct hashfile *f, uint8_t data)
|
||||||
{
|
{
|
||||||
hashwrite(f, &data, sizeof(data));
|
hashwrite(f, &data, sizeof(data));
|
||||||
|
Reference in New Issue
Block a user