diff options
Diffstat (limited to 'src/hash.c')
-rw-r--r-- | src/hash.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/hash.c b/src/hash.c index 336030d41..21db2e129 100644 --- a/src/hash.c +++ b/src/hash.c @@ -10,38 +10,38 @@ int git_hash_buf(git_oid *out, const void *data, size_t len) { - git_hash_ctx *ctx; + git_hash_ctx ctx; int error = 0; - if ((ctx = git_hash_ctx_new()) == NULL) + if (git_hash_ctx_init(&ctx) < 0) return -1; - if ((error = git_hash_update(ctx, data, len)) >= 0) - error = git_hash_final(out, ctx); + if ((error = git_hash_update(&ctx, data, len)) >= 0) + error = git_hash_final(out, &ctx); - git_hash_ctx_free(ctx); + git_hash_ctx_cleanup(&ctx); return error; } int git_hash_vec(git_oid *out, git_buf_vec *vec, size_t n) { - git_hash_ctx *ctx; + git_hash_ctx ctx; size_t i; int error = 0; - if ((ctx = git_hash_ctx_new()) == NULL) + if (git_hash_ctx_init(&ctx) < 0) return -1; for (i = 0; i < n; i++) { - if ((error = git_hash_update(ctx, vec[i].data, vec[i].len)) < 0) + if ((error = git_hash_update(&ctx, vec[i].data, vec[i].len)) < 0) goto done; } - error = git_hash_final(out, ctx); + error = git_hash_final(out, &ctx); done: - git_hash_ctx_free(ctx); + git_hash_ctx_cleanup(&ctx); return error; } |