diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-04-23 19:58:13 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-04-23 23:44:32 +0200 |
commit | 2ed91f222f1dddda10fbdc9cb80df2be7d4c2da3 (patch) | |
tree | a5448dfc1bd0440167cdfad4e3041ca1548bbf52 /src/nvim/api/private/helpers.c | |
parent | 62c3f436a96e2102ec5c1e3af974c8e57fe4e76c (diff) | |
download | rneovim-2ed91f222f1dddda10fbdc9cb80df2be7d4c2da3.tar.gz rneovim-2ed91f222f1dddda10fbdc9cb80df2be7d4c2da3.tar.bz2 rneovim-2ed91f222f1dddda10fbdc9cb80df2be7d4c2da3.zip |
api/internal: Remove `set` field from Error type.
Diffstat (limited to 'src/nvim/api/private/helpers.c')
-rw-r--r-- | src/nvim/api/private/helpers.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index 3bf584ff2f..58534d78a0 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -69,7 +69,7 @@ bool try_end(Error *err) ET_ERROR, NULL, &should_free); - _api_set_error(err, err->type, "%s", msg); + _api_set_error(err, kErrorTypeException, "%s", msg); free_global_msglist(); if (should_free) { @@ -80,7 +80,7 @@ bool try_end(Error *err) discard_current_exception(); } - return err->set; + return ERROR_SET(err); } /// Recursively expands a vimscript value in a dict @@ -803,11 +803,12 @@ void api_free_dictionary(Dictionary value) void api_clear_error(Error *value) FUNC_ATTR_NONNULL_ALL { - if (!value->set) { + if (!ERROR_SET(value)) { return; } xfree(value->msg); value->msg = NULL; + value->type = kErrorTypeNone; } Dictionary api_metadata(void) @@ -953,7 +954,7 @@ static void set_option_value_for(char *key, break; } - if (err->set) { + if (ERROR_SET(err)) { return; } @@ -981,6 +982,7 @@ static void set_option_value_err(char *key, void _api_set_error(Error *err, ErrorType errType, const char *format, ...) FUNC_ATTR_NONNULL_ALL { + assert(kErrorTypeNone != errType); va_list args1; va_list args2; va_start(args1, format); @@ -994,6 +996,5 @@ void _api_set_error(Error *err, ErrorType errType, const char *format, ...) vsnprintf(err->msg, bufsize, format, args2); va_end(args2); - err->set = true; err->type = errType; } |