summaryrefslogtreecommitdiff
path: root/src/indexer.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/indexer.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/indexer.c')
-rw-r--r--src/indexer.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/indexer.c b/src/indexer.c
index de1e5dc52..dd7c71962 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -171,7 +171,10 @@ static int index_path(git_buf *path, git_indexer *idx)
path->size += GIT_OID_HEXSZ;
git_buf_puts(path, suffix);
- return git_buf_lasterror(path);
+ if (git_buf_oom(path))
+ return GIT_ENOMEM;
+
+ return 0;
}
int git_indexer_write(git_indexer *idx)
@@ -192,8 +195,8 @@ int git_indexer_write(git_indexer *idx)
git_buf_truncate(&filename, filename.size - strlen("pack"));
git_buf_puts(&filename, "idx");
- if ((error = git_buf_lasterror(&filename)) < GIT_SUCCESS)
- goto cleanup;
+ if (git_buf_oom(&filename))
+ return GIT_ENOMEM;
error = git_filebuf_open(&idx->file, filename.ptr, GIT_FILEBUF_HASH_CONTENTS);
if (error < GIT_SUCCESS)