Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2012-11-13 05:22:49 +0400
committerEdward Thomson <ethomson@edwardthomson.com>2012-11-13 20:23:05 +0400
commit603bee07918b50051d7bb45722932fc409b38a67 (patch)
tree99951bc2c5470bc429d42eb9eb6151b2de6b08be /src/indexer.c
parentd6fb09240913c9756de5f4a2462062008ebac252 (diff)
Remove git_hash_ctx_new - callers now _ctx_init()
Diffstat (limited to 'src/indexer.c')
-rw-r--r--src/indexer.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/indexer.c b/src/indexer.c
index 20337d552..4a4ed325a 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -461,10 +461,10 @@ int git_indexer_stream_finalize(git_indexer_stream *idx, git_transfer_progress *
struct entry *entry;
void *packfile_hash;
git_oid file_hash;
- git_hash_ctx *ctx;
+ git_hash_ctx ctx;
- ctx = git_hash_ctx_new();
- GITERR_CHECK_ALLOC(ctx);
+ if (git_hash_ctx_init(&ctx) < 0)
+ return -1;
/* Test for this before resolve_deltas(), as it plays with idx->off */
if (idx->off < idx->pack->mwf.size - GIT_OID_RAWSZ) {
@@ -506,9 +506,9 @@ int git_indexer_stream_finalize(git_indexer_stream *idx, git_transfer_progress *
/* Write out the object names (SHA-1 hashes) */
git_vector_foreach(&idx->objects, i, entry) {
git_filebuf_write(&idx->index_file, &entry->oid, sizeof(git_oid));
- git_hash_update(ctx, &entry->oid, GIT_OID_RAWSZ);
+ git_hash_update(&ctx, &entry->oid, GIT_OID_RAWSZ);
}
- git_hash_final(&idx->hash, ctx);
+ git_hash_final(&idx->hash, &ctx);
/* Write out the CRC32 values */
git_vector_foreach(&idx->objects, i, entry) {
@@ -583,7 +583,7 @@ on_error:
p_close(idx->pack->mwf.fd);
git_filebuf_cleanup(&idx->index_file);
git_buf_free(&filename);
- git_hash_ctx_free(ctx);
+ git_hash_ctx_cleanup(&ctx);
return -1;
}
@@ -684,10 +684,10 @@ int git_indexer_write(git_indexer *idx)
struct entry *entry;
void *packfile_hash;
git_oid file_hash;
- git_hash_ctx *ctx;
+ git_hash_ctx ctx;
- ctx = git_hash_ctx_new();
- GITERR_CHECK_ALLOC(ctx);
+ if (git_hash_ctx_init(&ctx) < 0)
+ return -1;
git_vector_sort(&idx->objects);
@@ -719,11 +719,11 @@ int git_indexer_write(git_indexer *idx)
/* Write out the object names (SHA-1 hashes) */
git_vector_foreach(&idx->objects, i, entry) {
if ((error = git_filebuf_write(&idx->file, &entry->oid, sizeof(git_oid))) < 0 ||
- (error = git_hash_update(ctx, &entry->oid, GIT_OID_RAWSZ)) < 0)
+ (error = git_hash_update(&ctx, &entry->oid, GIT_OID_RAWSZ)) < 0)
goto cleanup;
}
- if ((error = git_hash_final(&idx->hash, ctx)) < 0)
+ if ((error = git_hash_final(&idx->hash, &ctx)) < 0)
goto cleanup;
/* Write out the CRC32 values */
@@ -802,7 +802,7 @@ cleanup:
if (error < 0)
git_filebuf_cleanup(&idx->file);
git_buf_free(&filename);
- git_hash_ctx_free(ctx);
+ git_hash_ctx_cleanup(&ctx);
return error;
}