summaryrefslogtreecommitdiff
path: root/src/attr_file.c
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-02-27 04:28:31 +0100
committerVicent Martí <tanoku@gmail.com>2012-02-27 05:30:07 +0100
commit13224ea4aad9a1b3c9cc4c992ceaea9af623e047 (patch)
treeb5c3a503d1ef7ba6269bf4291530c4e8e5936bdb /src/attr_file.c
parente07c2d225deec42e592133df49ad8c564d4d66c7 (diff)
downloadlibgit2-13224ea4aad9a1b3c9cc4c992ceaea9af623e047.tar.gz
buffer: Unify `git_fbuffer` and `git_buf`
This makes so much sense that I can't believe it hasn't been done before. Kill the old `git_fbuffer` and read files straight into `git_buf` objects. Also: In order to fully support 4GB files in 32-bit systems, the `git_buf` implementation has been changed from using `ssize_t` for storage and storing negative values on allocation failure, to using `size_t` and changing the buffer pointer to a magical pointer on allocation failure. Hopefully this won't break anything.
Diffstat (limited to 'src/attr_file.c')
-rw-r--r--src/attr_file.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/attr_file.c b/src/attr_file.c
index 7911381ea..a1b69a5bb 100644
--- a/src/attr_file.c
+++ b/src/attr_file.c
@@ -111,7 +111,7 @@ int git_attr_file__from_file(
git_repository *repo, const char *path, git_attr_file *file)
{
int error = GIT_SUCCESS;
- git_fbuffer fbuf = GIT_FBUFFER_INIT;
+ git_buf fbuf = GIT_BUF_INIT;
assert(path && file);
@@ -120,9 +120,9 @@ int git_attr_file__from_file(
if (error == GIT_SUCCESS &&
(error = git_futils_readbuffer(&fbuf, path)) == GIT_SUCCESS)
- error = git_attr_file__from_buffer(repo, fbuf.data, file);
+ error = git_attr_file__from_buffer(repo, fbuf.ptr, file);
- git_futils_freebuffer(&fbuf);
+ git_buf_free(&fbuf);
if (error != GIT_SUCCESS)
git__rethrow(error, "Could not open attribute file '%s'", path);