csum-file: store the hash algorithm as a struct field

Throughout the hashfile API, we rely on a reference to 'the_hash_algo',
and call its _unsafe function variants directly.

Prepare for a future change where we may use a different 'git_hash_algo'
pointer (instead of just relying on 'the_hash_algo' throughout) by
making the 'git_hash_algo' pointer a member of the 'hashfile' structure
itself.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Taylor Blau
2025-01-23 12:34:23 -05:00
committed by Junio C Hamano
parent d9213e4716
commit 48524fac64
2 changed files with 12 additions and 9 deletions

View File

@@ -20,6 +20,7 @@ struct hashfile {
size_t buffer_len;
unsigned char *buffer;
unsigned char *check_buffer;
const struct git_hash_algo *algop;
/**
* If non-zero, skip_hash indicates that we should