diff options
| author | Russell Belfer <rb@github.com> | 2012-09-21 15:04:39 -0700 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2012-09-21 15:04:39 -0700 |
| commit | 1a628100534a315bd00361fc3d32df671923c107 (patch) | |
| tree | c378b11f15a0323ff2c634bc63ec305255d45124 /src | |
| parent | 0cb24616eea3b92893b2a03e851a0db2c04862ef (diff) | |
| download | libgit2-1a628100534a315bd00361fc3d32df671923c107.tar.gz | |
Make giterr_set_str public
There has been discussion for a while about making some set of
the `giterr_set` type functions part of the public API for code
that is implementing new backends to libgit2. This makes the
`giterr_set_str()` and `giterr_set_oom()` functions public.
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); |
