diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common.h | 16 | ||||
| -rw-r--r-- | src/errors.c | 6 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/common.h b/src/common.h index 1d85428b3..747bbf7ce 100644 --- a/src/common.h +++ b/src/common.h @@ -49,14 +49,24 @@ #include <regex.h> +/** + * Check a pointer allocation result, returning -1 if it failed. + */ #define GITERR_CHECK_ALLOC(ptr) if (ptr == NULL) { return -1; } -void giterr_set_oom(void); +/** + * Set the error message for this thread, formatting as needed. + */ void giterr_set(int error_class, const char *string, ...); -void giterr_clear(void); -void giterr_set_str(int error_class, const char *string); + +/** + * Set the error message for a regex failure, using the internal regex + * error code lookup. + */ void giterr_set_regex(const regex_t *regex, int error_code); +/* NOTE: other giterr functions are in the public errors.h header file */ + #include "util.h" typedef struct git_transport git_transport; diff --git a/src/errors.c b/src/errors.c index 802ad3647..942a2f799 100644 --- a/src/errors.c +++ b/src/errors.c @@ -94,7 +94,11 @@ void giterr_set(int error_class, const char *string, ...) void giterr_set_str(int error_class, const char *string) { - char *message = git__strdup(string); + char *message; + + assert(string); + + message = git__strdup(string); if (message) set_error(error_class, message); |
