diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2019-01-13 21:10:50 +0000 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2019-05-19 11:12:13 +0100 |
| commit | fe1fb36e57a35c73740fc7ff2286fd0b7b3c0a20 (patch) | |
| tree | 7d76140932dc1f36dee11e75c348a6810ebb3820 /src/common.h | |
| parent | e4b2ef87c75ea48cba55bb32c327051ca82ddd90 (diff) | |
| download | libgit2-fe1fb36e57a35c73740fc7ff2286fd0b7b3c0a20.tar.gz | |
win32: move type definitions for improved inclusion
Move some win32 type definitions to a standalone file so that they can
be included before other header files try to use the definitions.
Diffstat (limited to 'src/common.h')
| -rw-r--r-- | src/common.h | 76 |
1 files changed, 2 insertions, 74 deletions
diff --git a/src/common.h b/src/common.h index 03679fc27..8a5761abc 100644 --- a/src/common.h +++ b/src/common.h @@ -47,6 +47,7 @@ # include <ws2tcpip.h> # include "win32/msvc-compat.h" # include "win32/mingw-compat.h" +# include "win32/w32_common.h" # include "win32/win32-compat.h" # include "win32/error.h" # include "win32/version.h" @@ -76,6 +77,7 @@ #include "git2/types.h" #include "git2/errors.h" +#include "errors.h" #include "thread-utils.h" #include "integer.h" @@ -110,80 +112,6 @@ do { int _err = (code); if (_err) return _err; } while (0) /** - * Set the error message for this thread, formatting as needed. - */ - -void git_error_set(int error_class, const char *string, ...) GIT_FORMAT_PRINTF(2, 3); - -/** - * Set the error message for a regex failure, using the internal regex - * error code lookup and return a libgit error code. - */ -int git_error_set_regex(const p_regex_t *regex, int error_code); - -/** - * Set error message for user callback if needed. - * - * If the error code in non-zero and no error message is set, this - * sets a generic error message. - * - * @return This always returns the `error_code` parameter. - */ -GIT_INLINE(int) git_error_set_after_callback_function( - int error_code, const char *action) -{ - if (error_code) { - const git_error *e = git_error_last(); - if (!e || !e->message) - git_error_set(e ? e->klass : GIT_ERROR_CALLBACK, - "%s callback returned %d", action, error_code); - } - return error_code; -} - -#ifdef GIT_WIN32 -#define git_error_set_after_callback(code) \ - git_error_set_after_callback_function((code), __FUNCTION__) -#else -#define git_error_set_after_callback(code) \ - git_error_set_after_callback_function((code), __func__) -#endif - -/** - * Gets the system error code for this thread. - */ -int git_error_system_last(void); - -/** - * Sets the system error code for this thread. - */ -void git_error_system_set(int code); - -/** - * Structure to preserve libgit2 error state - */ -typedef struct { - int error_code; - unsigned int oom : 1; - git_error error_msg; -} git_error_state; - -/** - * Capture current error state to restore later, returning error code. - * If `error_code` is zero, this does not clear the current error state. - * You must either restore this error state, or free it. - */ -extern int git_error_state_capture(git_error_state *state, int error_code); - -/** - * Restore error state to a previous value, returning saved error code. - */ -extern int git_error_state_restore(git_error_state *state); - -/** Free an error state. */ -extern void git_error_state_free(git_error_state *state); - -/** * Check a versioned structure for validity */ GIT_INLINE(int) git_error__check_version(const void *structure, unsigned int expected_max, const char *name) |
