diff options
author | Patrick Steinhardt <ps@pks.im> | 2017-10-13 13:14:54 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2018-06-22 09:50:07 +0200 |
commit | bbbe8441750a9072a6f4e96c8d364ede79dd2300 (patch) | |
tree | 218062644566d068814c917451c4355b47384885 | |
parent | 4e8dc055b6ec0a960f112178e81b56c8b464fe8c (diff) | |
download | libgit2-bbbe8441750a9072a6f4e96c8d364ede79dd2300.tar.gz |
blob: use getters to get raw blob content and size
Going forward, we will have to change how blob sizes are calculated
based on whether the blob is a cahed object part of the ODB or not. In
order to not have to distinguish between those two object types
repeatedly when accessing the blob's data or size, encapsulate all
existing direct uses of those fields by instead using
`git_blob_rawcontent` and `git_blob_rawsize`.
-rw-r--r-- | src/blob.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/blob.c b/src/blob.c index 86ec95c48..b1c028081 100644 --- a/src/blob.c +++ b/src/blob.c @@ -32,8 +32,8 @@ int git_blob__getbuf(git_buf *buffer, git_blob *blob) { return git_buf_set( buffer, - git_odb_object_data(blob->odb_object), - git_odb_object_size(blob->odb_object)); + git_blob_rawcontent(blob), + git_blob_rawsize(blob)); } void git_blob__free(void *blob) @@ -372,8 +372,8 @@ int git_blob_is_binary(const git_blob *blob) assert(blob); - git_buf_attach_notowned(&content, blob->odb_object->buffer, - min(blob->odb_object->cached.size, + git_buf_attach_notowned(&content, git_blob_rawcontent(blob), + min(git_blob_rawsize(blob), GIT_FILTER_BYTES_TO_CHECK_NUL)); return git_buf_text_is_binary(&content); } |