summaryrefslogtreecommitdiff
path: root/src/pack-objects.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/pack-objects.c
parentd6fb09240913c9756de5f4a2462062008ebac252 (diff)
downloadlibgit2-603bee07918b50051d7bb45722932fc409b38a67.tar.gz
Remove git_hash_ctx_new - callers now _ctx_init()
Diffstat (limited to 'src/pack-objects.c')
-rw-r--r--src/pack-objects.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/pack-objects.c b/src/pack-objects.c
index 58a70d0e0..f75267629 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -103,7 +103,7 @@ int git_packbuilder_new(git_packbuilder **out, git_repository *repo)
*out = NULL;
- pb = git__calloc(sizeof(*pb), 1);
+ pb = git__calloc(1, sizeof(*pb));
GITERR_CHECK_ALLOC(pb);
pb->object_ix = git_oidmap_alloc();
@@ -113,9 +113,8 @@ int git_packbuilder_new(git_packbuilder **out, git_repository *repo)
pb->repo = repo;
pb->nr_threads = 1; /* do not spawn any thread by default */
- pb->ctx = git_hash_ctx_new();
- if (!pb->ctx ||
+ if (git_hash_ctx_init(&pb->ctx) < 0 ||
git_repository_odb(&pb->odb, repo) < 0 ||
packbuilder_config(pb) < 0)
goto on_error;
@@ -297,12 +296,12 @@ static int write_object(git_buf *buf, git_packbuilder *pb, git_pobject *po)
if (git_buf_put(buf, (char *)hdr, hdr_len) < 0)
goto on_error;
- if (git_hash_update(pb->ctx, hdr, hdr_len) < 0)
+ if (git_hash_update(&pb->ctx, hdr, hdr_len) < 0)
goto on_error;
if (type == GIT_OBJ_REF_DELTA) {
if (git_buf_put(buf, (char *)po->delta->id.id, GIT_OID_RAWSZ) < 0 ||
- git_hash_update(pb->ctx, po->delta->id.id, GIT_OID_RAWSZ) < 0)
+ git_hash_update(&pb->ctx, po->delta->id.id, GIT_OID_RAWSZ) < 0)
goto on_error;
}
@@ -319,7 +318,7 @@ static int write_object(git_buf *buf, git_packbuilder *pb, git_pobject *po)
}
if (git_buf_put(buf, data, size) < 0 ||
- git_hash_update(pb->ctx, data, size) < 0)
+ git_hash_update(&pb->ctx, data, size) < 0)
goto on_error;
if (po->delta_data)
@@ -571,7 +570,7 @@ static int write_pack(git_packbuilder *pb,
if (cb(&ph, sizeof(ph), data) < 0)
goto on_error;
- if (git_hash_update(pb->ctx, &ph, sizeof(ph)) < 0)
+ if (git_hash_update(&pb->ctx, &ph, sizeof(ph)) < 0)
goto on_error;
pb->nr_remaining = pb->nr_objects;
@@ -592,7 +591,7 @@ static int write_pack(git_packbuilder *pb,
git__free(write_order);
git_buf_free(&buf);
- if (git_hash_final(&pb->pack_oid, pb->ctx) < 0)
+ if (git_hash_final(&pb->pack_oid, &pb->ctx) < 0)
goto on_error;
return cb(pb->pack_oid.id, GIT_OID_RAWSZ, data);
@@ -1319,14 +1318,13 @@ void git_packbuilder_free(git_packbuilder *pb)
if (pb->odb)
git_odb_free(pb->odb);
- if (pb->ctx)
- git_hash_ctx_free(pb->ctx);
-
if (pb->object_ix)
git_oidmap_free(pb->object_ix);
if (pb->object_list)
git__free(pb->object_list);
+ git_hash_ctx_cleanup(&pb->ctx);
+
git__free(pb);
}