diff options
author | Edward Thomson <ethomson@microsoft.com> | 2012-11-12 19:22:49 -0600 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2012-11-13 10:23:05 -0600 |
commit | 603bee07918b50051d7bb45722932fc409b38a67 (patch) | |
tree | 99951bc2c5470bc429d42eb9eb6151b2de6b08be /src/filebuf.c | |
parent | d6fb09240913c9756de5f4a2462062008ebac252 (diff) | |
download | libgit2-603bee07918b50051d7bb45722932fc409b38a67.tar.gz |
Remove git_hash_ctx_new - callers now _ctx_init()
Diffstat (limited to 'src/filebuf.c')
-rw-r--r-- | src/filebuf.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/filebuf.c b/src/filebuf.c index 6194fe5e3..287446673 100644 --- a/src/filebuf.c +++ b/src/filebuf.c @@ -108,8 +108,10 @@ void git_filebuf_cleanup(git_filebuf *file) if (file->fd_is_open && file->path_lock && git_path_exists(file->path_lock)) p_unlink(file->path_lock); - if (file->digest) - git_hash_ctx_free(file->digest); + if (file->digest) { + git_hash_ctx_cleanup(file->digest); + git__free(file->digest); + } if (file->buffer) git__free(file->buffer); @@ -221,8 +223,11 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags) /* If we are hashing on-write, allocate a new hash context */ if (flags & GIT_FILEBUF_HASH_CONTENTS) { - file->digest = git_hash_ctx_new(); + file->digest = git__calloc(1, sizeof(git_hash_ctx)); GITERR_CHECK_ALLOC(file->digest); + + if (git_hash_ctx_init(file->digest) < 0) + goto cleanup; } compression = flags >> GIT_FILEBUF_DEFLATE_SHIFT; @@ -299,7 +304,8 @@ int git_filebuf_hash(git_oid *oid, git_filebuf *file) return -1; git_hash_final(oid, file->digest); - git_hash_ctx_free(file->digest); + git_hash_ctx_cleanup(file->digest); + git__free(file->digest); file->digest = NULL; return 0; |