summaryrefslogtreecommitdiff
path: root/src/common.h
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-03-09 19:55:50 +0100
committerVicent Martí <tanoku@gmail.com>2012-03-09 20:09:22 +0100
commitdda708e78f3c3f43d814d46c29ab9f2b9d47ed5c (patch)
tree60a6e01583c15209a42740a46e182ac7cbc893de /src/common.h
parent6af24ce31f43c3621f11720704a078058665bc3f (diff)
downloadlibgit2-dda708e78f3c3f43d814d46c29ab9f2b9d47ed5c.tar.gz
error-handling: On-disk config file backend
Includes: - Proper error reporting when encountering syntax errors in a config file (file, line number, column). - Rewritten `config_write`, now with 99% less goto-spaghetti - Error state in `git_filebuf`: filebuf write functions no longer need to be checked for error returns. If any of the writes performed on a buffer fail, the last call to `git_filebuf_commit` or `git_filebuf_hash` will fail accordingly and set the appropiate error message. Baller!
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index 0b4dc2e49..30757de70 100644
--- a/src/common.h
+++ b/src/common.h
@@ -46,6 +46,8 @@
#include "thread-utils.h"
#include "bswap.h"
+#include <regex.h>
+
extern void git___throw(const char *, ...) GIT_FORMAT_PRINTF(1, 2);
#define git__throw(error, ...) \
(git___throw(__VA_ARGS__), error)
@@ -54,6 +56,16 @@ extern void git___rethrow(const char *, ...) GIT_FORMAT_PRINTF(1, 2);
#define git__rethrow(error, ...) \
(git___rethrow(__VA_ARGS__), error)
+
+#define GITERR_CHECK_ALLOC(ptr) if (ptr == NULL) { return -1; }
+
+void giterr_set_oom(void);
+void giterr_set(int error_class, const char *string, ...);
+void giterr_clear(void);
+void giterr_set_str(int error_class, const char *string);
+void giterr_set_regex(const regex_t *regex, int error_code);
+
+
#include "util.h"