Commit bbbe8441 by Patrick Steinhardt

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`.
parent 4e8dc055
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment