diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2015-08-04 11:18:21 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-08-04 11:18:21 +0200 |
| commit | cf716beed2f4729cf01a9822d75b4f1ebf7ccbf1 (patch) | |
| tree | 2e02b7fcc28a00c0eede602b8880b83a9fd35c77 /src/common.h | |
| parent | 69adb781e17f77b19d66613ad7e52c38d6ac64e1 (diff) | |
| parent | ef4857c2b3d4a61fd1d840199afc92eaf2e15345 (diff) | |
| download | libgit2-cf716beed2f4729cf01a9822d75b4f1ebf7ccbf1.tar.gz | |
Merge pull request #3351 from ethomson/error_buf
Error handling: use buffers, improved OOM handling
Diffstat (limited to 'src/common.h')
| -rw-r--r-- | src/common.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/common.h b/src/common.h index 2b1dedc01..6dca36fbd 100644 --- a/src/common.h +++ b/src/common.h @@ -141,20 +141,25 @@ void giterr_system_set(int code); * Structure to preserve libgit2 error state */ typedef struct { - int error_code; + 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 nothing and returns zero. + * If `error_code` is zero, this does not clear the current error state. + * You must either restore this error state, or free it. */ -int giterr_capture(git_error_state *state, int error_code); +extern int giterr_state_capture(git_error_state *state, int error_code); /** * Restore error state to a previous value, returning saved error code. */ -int giterr_restore(git_error_state *state); +extern int giterr_state_restore(git_error_state *state); + +/** Free an error state. */ +extern void giterr_state_free(git_error_state *state); /** * Check a versioned structure for validity |
