summaryrefslogtreecommitdiff
path: root/src/git/blob.h
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-11-20 17:37:32 +0200
committerVicent Marti <tanoku@gmail.com>2010-11-20 17:37:32 +0200
commit30b171a185a1ef788d41265f08ad1da98d72918a (patch)
treeb1e2de22198c7832fc9ab9d3563259c510181fc2 /src/git/blob.h
parent69a09b7c6972343e321c7c0e3441fcc4b5340444 (diff)
downloadlibgit2-30b171a185a1ef788d41265f08ad1da98d72918a.tar.gz
Change blob API to return temp refs to the content
If the user wants permanent references, he can duplicate the temporary one manually. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/git/blob.h')
-rw-r--r--src/git/blob.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/git/blob.h b/src/git/blob.h
index 23afd64a9..93ced42ee 100644
--- a/src/git/blob.h
+++ b/src/git/blob.h
@@ -63,18 +63,17 @@ GIT_EXTERN(int) git_blob_set_rawcontent_fromfile(git_blob *blob, const char *fil
GIT_EXTERN(int) git_blob_set_rawcontent(git_blob *blob, const void *buffer, size_t len);
/**
- * Read the raw content of a blob.
+ * Get a read-only buffer with the raw content of a blob.
*
- * A copy of the raw content is stored on the buffer passed
- * to the function. If the buffer is not long enough,
- * the method will fail.
+ * A pointer to the raw content of a blob is returned;
+ * this pointer is owned internally by the object and shall
+ * not be free'd. The pointer may be invalidated at a later
+ * time (e.g. when changing the contents of the blob).
*
* @param blob pointer to the blob
- * @param buffer buffer to fill with contents
- * @param len size of the buffer
- * @return 0 on success; error code otherwise
+ * @return the pointer; NULL if the blob has no contents
*/
-GIT_EXTERN(int) git_blob_rawcontent(git_blob *blob, void *buffer, size_t len);
+GIT_EXTERN(const char *) git_blob_rawcontent(git_blob *blob);
/**
* Get the size in bytes of the contents of a blob