aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/fast-import.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-02-10 10:18:30 -0800
committerJunio C Hamano <gitster@pobox.com>2025-02-10 10:18:31 -0800
commit246569bf83f2a586268d26559c7d6ea54c9316b6 (patch)
tree29bdf8fd459a337adef85012b88d6ed71830a147 /builtin/fast-import.c
parent0ca6b46d7ca17988da3b7292097e5608be81abad (diff)
parent0578f1e66aa381356bfe2f53decf3864d88d23d3 (diff)
downloadgit-246569bf83f2a586268d26559c7d6ea54c9316b6.tar.gz
Merge branch 'ps/hash-cleanup'
Further code clean-up on the use of hash functions. Now the context object knows what hash function it is working with. * ps/hash-cleanup: global: adapt callers to use generic hash context helpers hash: provide generic wrappers to update hash contexts hash: stop typedeffing the hash context hash: convert hashing context to a structure
Diffstat (limited to 'builtin/fast-import.c')
-rw-r--r--builtin/fast-import.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index a6a84058cd..d6a368a566 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -954,15 +954,15 @@ static int store_object(
unsigned char hdr[96];
struct object_id oid;
unsigned long hdrlen, deltalen;
- git_hash_ctx c;
+ struct git_hash_ctx c;
git_zstream s;
hdrlen = format_object_header((char *)hdr, sizeof(hdr), type,
dat->len);
the_hash_algo->init_fn(&c);
- the_hash_algo->update_fn(&c, hdr, hdrlen);
- the_hash_algo->update_fn(&c, dat->buf, dat->len);
- the_hash_algo->final_oid_fn(&oid, &c);
+ git_hash_update(&c, hdr, hdrlen);
+ git_hash_update(&c, dat->buf, dat->len);
+ git_hash_final_oid(&oid, &c);
if (oidout)
oidcpy(oidout, &oid);
@@ -1096,7 +1096,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
struct object_id oid;
unsigned long hdrlen;
off_t offset;
- git_hash_ctx c;
+ struct git_hash_ctx c;
git_zstream s;
struct hashfile_checkpoint checkpoint;
int status = Z_OK;
@@ -1114,7 +1114,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
hdrlen = format_object_header((char *)out_buf, out_sz, OBJ_BLOB, len);
the_hash_algo->init_fn(&c);
- the_hash_algo->update_fn(&c, out_buf, hdrlen);
+ git_hash_update(&c, out_buf, hdrlen);
crc32_begin(pack_file);
@@ -1132,7 +1132,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
if (!n && feof(stdin))
die("EOF in data (%" PRIuMAX " bytes remaining)", len);
- the_hash_algo->update_fn(&c, in_buf, n);
+ git_hash_update(&c, in_buf, n);
s.next_in = in_buf;
s.avail_in = n;
len -= n;
@@ -1158,7 +1158,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
}
}
git_deflate_end(&s);
- the_hash_algo->final_oid_fn(&oid, &c);
+ git_hash_final_oid(&oid, &c);
if (oidout)
oidcpy(oidout, &oid);