|
47 | 47 | # include <ws2tcpip.h> |
48 | 48 | # include "win32/msvc-compat.h" |
49 | 49 | # include "win32/mingw-compat.h" |
| 50 | +# include "win32/w32_common.h" |
50 | 51 | # include "win32/win32-compat.h" |
51 | 52 | # include "win32/error.h" |
52 | 53 | # include "win32/version.h" |
|
76 | 77 |
|
77 | 78 | #include "git2/types.h" |
78 | 79 | #include "git2/errors.h" |
| 80 | +#include "errors.h" |
79 | 81 | #include "thread-utils.h" |
80 | 82 | #include "integer.h" |
81 | 83 |
|
|
109 | 111 | #define GIT_ERROR_CHECK_ERROR(code) \ |
110 | 112 | do { int _err = (code); if (_err) return _err; } while (0) |
111 | 113 |
|
112 | | -/** |
113 | | - * Set the error message for this thread, formatting as needed. |
114 | | - */ |
115 | | - |
116 | | -void git_error_set(int error_class, const char *string, ...) GIT_FORMAT_PRINTF(2, 3); |
117 | | - |
118 | | -/** |
119 | | - * Set the error message for a regex failure, using the internal regex |
120 | | - * error code lookup and return a libgit error code. |
121 | | - */ |
122 | | -int git_error_set_regex(const p_regex_t *regex, int error_code); |
123 | | - |
124 | | -/** |
125 | | - * Set error message for user callback if needed. |
126 | | - * |
127 | | - * If the error code in non-zero and no error message is set, this |
128 | | - * sets a generic error message. |
129 | | - * |
130 | | - * @return This always returns the `error_code` parameter. |
131 | | - */ |
132 | | -GIT_INLINE(int) git_error_set_after_callback_function( |
133 | | - int error_code, const char *action) |
134 | | -{ |
135 | | - if (error_code) { |
136 | | - const git_error *e = git_error_last(); |
137 | | - if (!e || !e->message) |
138 | | - git_error_set(e ? e->klass : GIT_ERROR_CALLBACK, |
139 | | - "%s callback returned %d", action, error_code); |
140 | | - } |
141 | | - return error_code; |
142 | | -} |
143 | | - |
144 | | -#ifdef GIT_WIN32 |
145 | | -#define git_error_set_after_callback(code) \ |
146 | | - git_error_set_after_callback_function((code), __FUNCTION__) |
147 | | -#else |
148 | | -#define git_error_set_after_callback(code) \ |
149 | | - git_error_set_after_callback_function((code), __func__) |
150 | | -#endif |
151 | | - |
152 | | -/** |
153 | | - * Gets the system error code for this thread. |
154 | | - */ |
155 | | -int git_error_system_last(void); |
156 | | - |
157 | | -/** |
158 | | - * Sets the system error code for this thread. |
159 | | - */ |
160 | | -void git_error_system_set(int code); |
161 | | - |
162 | | -/** |
163 | | - * Structure to preserve libgit2 error state |
164 | | - */ |
165 | | -typedef struct { |
166 | | - int error_code; |
167 | | - unsigned int oom : 1; |
168 | | - git_error error_msg; |
169 | | -} git_error_state; |
170 | | - |
171 | | -/** |
172 | | - * Capture current error state to restore later, returning error code. |
173 | | - * If `error_code` is zero, this does not clear the current error state. |
174 | | - * You must either restore this error state, or free it. |
175 | | - */ |
176 | | -extern int git_error_state_capture(git_error_state *state, int error_code); |
177 | | - |
178 | | -/** |
179 | | - * Restore error state to a previous value, returning saved error code. |
180 | | - */ |
181 | | -extern int git_error_state_restore(git_error_state *state); |
182 | | - |
183 | | -/** Free an error state. */ |
184 | | -extern void git_error_state_free(git_error_state *state); |
185 | | - |
186 | 114 | /** |
187 | 115 | * Check a versioned structure for validity |
188 | 116 | */ |
|
0 commit comments