hash: stop typedeffing the hash context

We generally avoid using `typedef` in the Git codebase. One exception
though is the `git_hash_ctx`, likely because it used to be a union
rather than a struct until the preceding commit refactored it. But now
that it is a normal `struct` there isn't really a need for a typedef
anymore.

Drop the typedef and adapt all callers accordingly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2025-01-31 13:55:29 +01:00
committed by Junio C Hamano
parent 52eef501e1
commit 7346e340f1
22 changed files with 73 additions and 74 deletions

View File

@ -1717,7 +1717,7 @@ int verify_ce_order;
static int verify_hdr(const struct cache_header *hdr, unsigned long size)
{
git_hash_ctx c;
struct git_hash_ctx c;
unsigned char hash[GIT_MAX_RAWSZ];
int hdr_version;
unsigned char *start, *end;
@ -2002,7 +2002,7 @@ static struct index_entry_offset_table *read_ieot_extension(const char *mmap, si
static void write_ieot_extension(struct strbuf *sb, struct index_entry_offset_table *ieot);
static size_t read_eoie_extension(const char *mmap, size_t mmap_size);
static void write_eoie_extension(struct strbuf *sb, git_hash_ctx *eoie_context, size_t offset);
static void write_eoie_extension(struct strbuf *sb, struct git_hash_ctx *eoie_context, size_t offset);
struct load_index_extensions
{
@ -2566,7 +2566,7 @@ int repo_index_has_changes(struct repository *repo,
}
static int write_index_ext_header(struct hashfile *f,
git_hash_ctx *eoie_f,
struct git_hash_ctx *eoie_f,
unsigned int ext,
unsigned int sz)
{
@ -2831,7 +2831,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
{
uint64_t start = getnanotime();
struct hashfile *f;
git_hash_ctx *eoie_c = NULL;
struct git_hash_ctx *eoie_c = NULL;
struct cache_header hdr;
int i, err = 0, removed, extended, hdr_version;
struct cache_entry **cache = istate->cache;
@ -3579,7 +3579,7 @@ static size_t read_eoie_extension(const char *mmap, size_t mmap_size)
uint32_t extsize;
size_t offset, src_offset;
unsigned char hash[GIT_MAX_RAWSZ];
git_hash_ctx c;
struct git_hash_ctx c;
/* ensure we have an index big enough to contain an EOIE extension */
if (mmap_size < sizeof(struct cache_header) + EOIE_SIZE_WITH_HEADER + the_hash_algo->rawsz)
@ -3650,7 +3650,7 @@ static size_t read_eoie_extension(const char *mmap, size_t mmap_size)
return offset;
}
static void write_eoie_extension(struct strbuf *sb, git_hash_ctx *eoie_context, size_t offset)
static void write_eoie_extension(struct strbuf *sb, struct git_hash_ctx *eoie_context, size_t offset)
{
uint32_t buffer;
unsigned char hash[GIT_MAX_RAWSZ];