summaryrefslogtreecommitdiff
path: root/src/odb.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2012-11-12 19:22:49 -0600
committerEdward Thomson <ethomson@edwardthomson.com>2012-11-13 10:23:05 -0600
commit603bee07918b50051d7bb45722932fc409b38a67 (patch)
tree99951bc2c5470bc429d42eb9eb6151b2de6b08be /src/odb.c
parentd6fb09240913c9756de5f4a2462062008ebac252 (diff)
downloadlibgit2-603bee07918b50051d7bb45722932fc409b38a67.tar.gz
Remove git_hash_ctx_new - callers now _ctx_init()
Diffstat (limited to 'src/odb.c')
-rw-r--r--src/odb.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/odb.c b/src/odb.c
index 027aeddaa..bc135e35c 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -117,7 +117,7 @@ int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_otype type)
{
int hdr_len;
char hdr[64], buffer[2048];
- git_hash_ctx *ctx;
+ git_hash_ctx ctx;
ssize_t read_len = 0;
int error = 0;
@@ -126,16 +126,16 @@ int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_otype type)
return -1;
}
- ctx = git_hash_ctx_new();
- GITERR_CHECK_ALLOC(ctx);
+ if ((error = git_hash_ctx_init(&ctx)) < 0)
+ return -1;
hdr_len = format_object_header(hdr, sizeof(hdr), size, type);
- if ((error = git_hash_update(ctx, hdr, hdr_len)) < 0)
+ if ((error = git_hash_update(&ctx, hdr, hdr_len)) < 0)
goto done;
while (size > 0 && (read_len = p_read(fd, buffer, sizeof(buffer))) > 0) {
- if ((error = git_hash_update(ctx, buffer, read_len)) < 0)
+ if ((error = git_hash_update(&ctx, buffer, read_len)) < 0)
goto done;
size -= read_len;
@@ -152,10 +152,10 @@ int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_otype type)
return -1;
}
- 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;
}