From cb8a79617b15e347f26d21cedde0f2b8670c1876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicent=20Mart=C3=AD?= Date: Wed, 7 Mar 2012 00:02:55 +0100 Subject: 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. --- src/buffer.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/buffer.c') 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) { -- cgit v1.2.3