From abe2efe1ff84d423ef5f104b1e95e9ef66442c0f Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 9 Dec 2019 12:37:34 +1000 Subject: Introduce GIT_ASSERT macros Provide macros to replace usages of `assert`. A true `assert` is punishing as a library. Instead we should do our best to not crash. GIT_ASSERT_ARG(x) will now assert that the given argument complies to some format and sets an error message and returns `-1` if it does not. GIT_ASSERT(x) is for internal usage, and available as an internal consistency check. It will set an error message and return `-1` in the event of failure. --- include/git2/errors.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/git2/errors.h') diff --git a/include/git2/errors.h b/include/git2/errors.h index 5c85c4d6c..8887b3299 100644 --- a/include/git2/errors.h +++ b/include/git2/errors.h @@ -107,7 +107,8 @@ typedef enum { GIT_ERROR_PATCH, GIT_ERROR_WORKTREE, GIT_ERROR_SHA1, - GIT_ERROR_HTTP + GIT_ERROR_HTTP, + GIT_ERROR_INTERNAL } git_error_t; /** -- cgit v1.2.1