diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-01-31 13:55:31 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-01-31 10:06:11 -0800 |
| commit | 0578f1e66aa381356bfe2f53decf3864d88d23d3 (patch) | |
| tree | ca26e9efacec048463fe529f72998ba59924f479 /http-push.c | |
| parent | hash: provide generic wrappers to update hash contexts (diff) | |
| download | git-0578f1e66aa381356bfe2f53decf3864d88d23d3.tar.gz git-0578f1e66aa381356bfe2f53decf3864d88d23d3.zip | |
global: adapt callers to use generic hash context helpers
Adapt callers to use generic hash context helpers instead of using the
hash algorithm to update them. This makes the callsites easier to reason
about and removes the possibility that the wrong hash algorithm is used
to update the hash context's state. And as a nice side effect this also
gets rid of a bunch of users of `the_hash_algo`.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http-push.c')
| -rw-r--r-- | http-push.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/http-push.c b/http-push.c index 36867af2f8..1b030d96f4 100644 --- a/http-push.c +++ b/http-push.c @@ -774,8 +774,8 @@ static void handle_new_lock_ctx(struct xml_ctx *ctx, int tag_closed) lock->token = xstrdup(ctx->cdata); the_hash_algo->init_fn(&hash_ctx); - the_hash_algo->update_fn(&hash_ctx, lock->token, strlen(lock->token)); - the_hash_algo->final_fn(lock_token_hash, &hash_ctx); + git_hash_update(&hash_ctx, lock->token, strlen(lock->token)); + git_hash_final(lock_token_hash, &hash_ctx); lock->tmpfile_suffix[0] = '_'; memcpy(lock->tmpfile_suffix + 1, hash_to_hex(lock_token_hash), the_hash_algo->hexsz); |
