summaryrefslogtreecommitdiff
path: root/src/odb_loose.c
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-03-07 00:02:55 +0100
committerVicent Martí <tanoku@gmail.com>2012-03-07 00:11:43 +0100
commitcb8a79617b15e347f26d21cedde0f2b8670c1876 (patch)
tree459706192f41bbf15496f0c9bfe2e21b16a7e70b /src/odb_loose.c
parent9d160ba85539bbc593369f597a07d42c2770dff4 (diff)
downloadlibgit2-cb8a79617b15e347f26d21cedde0f2b8670c1876.tar.gz
error-handling: Repository
This also includes droping `git_buf_lasterror` because it makes no sense in the new system. Note that in most of the places were it has been dropped, the code needs cleanup. I.e. GIT_ENOMEM is going away, so instead it should return a generic `-1` and obviously not throw anything.
Diffstat (limited to 'src/odb_loose.c')
-rw-r--r--src/odb_loose.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/odb_loose.c b/src/odb_loose.c
index 2dd7004ab..17fede4a3 100644
--- a/src/odb_loose.c
+++ b/src/odb_loose.c
@@ -387,8 +387,8 @@ static int read_loose(git_rawobj *out, git_buf *loc)
assert(out && loc);
- if ((error = git_buf_lasterror(loc)) < GIT_SUCCESS)
- return error;
+ if (git_buf_oom(loc))
+ return GIT_ENOMEM;
out->data = NULL;
out->len = 0;
@@ -413,8 +413,8 @@ static int read_header_loose(git_rawobj *out, git_buf *loc)
assert(out && loc);
- if ((error = git_buf_lasterror(loc)) < GIT_SUCCESS)
- return error;
+ if (git_buf_oom(loc))
+ return GIT_ENOMEM;
out->data = NULL;
@@ -704,8 +704,8 @@ static int loose_backend__stream_fwrite(git_oid *oid, git_odb_stream *_stream)
if ((error = object_file_name(&final_path, backend->objects_dir, oid)) < GIT_SUCCESS)
goto cleanup;
- if ((error = git_buf_lasterror(&final_path)) < GIT_SUCCESS)
- goto cleanup;
+ if (git_buf_oom(&final_path))
+ return GIT_ENOMEM;
if ((error = git_futils_mkpath2file(final_path.ptr, GIT_OBJECT_DIR_MODE)) < GIT_SUCCESS)
goto cleanup;