summaryrefslogtreecommitdiff
path: root/src/errors.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2013-11-05 14:56:10 +0100
committerVicent Marti <tanoku@gmail.com>2013-11-05 14:56:10 +0100
commit1eab9f0e32178a9aac941583c69e1b9cf9849f77 (patch)
tree7d1648b25f154516680397b4fb3941e50ef2c3b7 /src/errors.c
parent3b259cbd1afdc96a3c3eb7af5895b310c1ac2a7d (diff)
downloadlibgit2-1eab9f0e32178a9aac941583c69e1b9cf9849f77.tar.gz
error: Simplify giterr_detach
Diffstat (limited to 'src/errors.c')
-rw-r--r--src/errors.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/errors.c b/src/errors.c
index 70b5f2668..d04da4ca9 100644
--- a/src/errors.c
+++ b/src/errors.c
@@ -112,27 +112,22 @@ void giterr_clear(void)
#endif
}
-git_error_t giterr_detach(git_buf *message)
+int giterr_detach(git_error *cpy)
{
- git_error_t rval;
git_error *error = GIT_GLOBAL->last_error;
- assert(message);
-
- git_buf_free(message);
+ assert(cpy);
if (!error)
- return GITERR_NONE;
-
- rval = error->klass;
+ return -1;
- if (error != &g_git_oom_error)
- git_buf_attach(message, error->message, 0);
+ cpy->message = error->message;
+ cpy->klass = error->klass;
error->message = NULL;
giterr_clear();
- return rval;
+ return 0;
}
const git_error *giterr_last(void)