Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-03-07 03:02:55 +0400
committerVicent Martí <tanoku@gmail.com>2012-03-07 03:11:43 +0400
commitcb8a79617b15e347f26d21cedde0f2b8670c1876 (patch)
tree459706192f41bbf15496f0c9bfe2e21b16a7e70b /src/buffer.c
parent9d160ba85539bbc593369f597a07d42c2770dff4 (diff)
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/buffer.c')
-rw-r--r--src/buffer.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 3098f6d68..dd245e243 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -70,7 +70,7 @@ int git_buf_try_grow(git_buf *buf, size_t target_size)
new_ptr = git__realloc(new_ptr, new_size);
if (!new_ptr)
- return GIT_ENOMEM;
+ return -1;
buf->asize = new_size;
buf->ptr = new_ptr;
@@ -100,16 +100,11 @@ void git_buf_clear(git_buf *buf)
buf->ptr[0] = '\0';
}
-int git_buf_oom(const git_buf *buf)
+bool git_buf_oom(const git_buf *buf)
{
return (buf->ptr == &git_buf__oom);
}
-int git_buf_lasterror(const git_buf *buf)
-{
- return (buf->ptr == &git_buf__oom) ? GIT_ENOMEM : GIT_SUCCESS;
-}
-
int git_buf_set(git_buf *buf, const char *data, size_t len)
{
if (len == 0 || data == NULL) {