aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/gendispatch.lua4
-rw-r--r--src/nvim/api/buffer.c36
-rw-r--r--src/nvim/api/private/helpers.c62
-rw-r--r--src/nvim/api/ui.c18
-rw-r--r--src/nvim/api/vim.c26
-rw-r--r--src/nvim/api/window.c10
-rw-r--r--src/nvim/msgpack_rpc/channel.c12
-rw-r--r--src/nvim/msgpack_rpc/helpers.c20
8 files changed, 94 insertions, 94 deletions
diff --git a/scripts/gendispatch.lua b/scripts/gendispatch.lua
index 53af67cce4..0ee3ae6475 100644
--- a/scripts/gendispatch.lua
+++ b/scripts/gendispatch.lua
@@ -225,7 +225,7 @@ for i = 1, #functions do
end
output:write('\n')
output:write('\n if (args.size != '..#fn.parameters..') {')
- output:write('\n _api_set_error(error, kErrorTypeException, "Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);')
+ output:write('\n api_set_error(error, kErrorTypeException, "Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);')
output:write('\n goto cleanup;')
output:write('\n }\n')
@@ -250,7 +250,7 @@ for i = 1, #functions do
output:write('\n '..converted..' = (handle_T)args.items['..(j - 1)..'].data.integer;')
end
output:write('\n } else {')
- output:write('\n _api_set_error(error, kErrorTypeException, "Wrong type for argument '..j..', expecting '..param[1]..'");')
+ output:write('\n api_set_error(error, kErrorTypeException, "Wrong type for argument '..j..', expecting '..param[1]..'");')
output:write('\n goto cleanup;')
output:write('\n }\n')
else
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index cffc7a2e38..4d6081bb5e 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -171,7 +171,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id,
end = normalize_index(buf, end, &oob);
if (strict_indexing && oob) {
- _api_set_error(err, kErrorTypeValidation, _("Index out of bounds"));
+ api_set_error(err, kErrorTypeValidation, _("Index out of bounds"));
return rv;
}
@@ -187,7 +187,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id,
int64_t lnum = start + (int64_t)i;
if (lnum > LONG_MAX) {
- _api_set_error(err, kErrorTypeValidation, _("Line index is too high"));
+ api_set_error(err, kErrorTypeValidation, _("Line index is too high"));
goto end;
}
@@ -283,13 +283,13 @@ void nvim_buf_set_lines(uint64_t channel_id,
end = normalize_index(buf, end, &oob);
if (strict_indexing && oob) {
- _api_set_error(err, kErrorTypeValidation, _("Index out of bounds"));
+ api_set_error(err, kErrorTypeValidation, _("Index out of bounds"));
return;
}
if (start > end) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeValidation,
_("Argument \"start\" is higher than \"end\""));
return;
@@ -304,7 +304,7 @@ void nvim_buf_set_lines(uint64_t channel_id,
for (size_t i = 0; i < new_len; i++) {
if (replacement.items[i].type != kObjectTypeString) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeValidation,
_("All items in the replacement array must be strings"));
goto end;
@@ -317,7 +317,7 @@ void nvim_buf_set_lines(uint64_t channel_id,
lines[i] = xmallocz(l.size);
for (size_t j = 0; j < l.size; j++) {
if (l.data[j] == '\n' && channel_id != INTERNAL_CALL) {
- _api_set_error(err, kErrorTypeException, _("string cannot contain newlines"));
+ api_set_error(err, kErrorTypeException, _("string cannot contain newlines"));
new_len = i + 1;
goto end;
}
@@ -330,7 +330,7 @@ void nvim_buf_set_lines(uint64_t channel_id,
switch_to_win_for_buf(buf, &save_curwin, &save_curtab, &save_curbuf);
if (u_save((linenr_T)(start - 1), (linenr_T)end) == FAIL) {
- _api_set_error(err, kErrorTypeException, _("Failed to save undo information"));
+ api_set_error(err, kErrorTypeException, _("Failed to save undo information"));
goto end;
}
@@ -340,7 +340,7 @@ void nvim_buf_set_lines(uint64_t channel_id,
size_t to_delete = (new_len < old_len) ? (size_t)(old_len - new_len) : 0;
for (size_t i = 0; i < to_delete; i++) {
if (ml_delete((linenr_T)start, false) == FAIL) {
- _api_set_error(err, kErrorTypeException, _("Failed to delete line"));
+ api_set_error(err, kErrorTypeException, _("Failed to delete line"));
goto end;
}
}
@@ -357,12 +357,12 @@ void nvim_buf_set_lines(uint64_t channel_id,
int64_t lnum = start + (int64_t)i;
if (lnum > LONG_MAX) {
- _api_set_error(err, kErrorTypeValidation, _("Index value is too high"));
+ api_set_error(err, kErrorTypeValidation, _("Index value is too high"));
goto end;
}
if (ml_replace((linenr_T)lnum, (char_u *)lines[i], false) == FAIL) {
- _api_set_error(err, kErrorTypeException, _("Failed to replace line"));
+ api_set_error(err, kErrorTypeException, _("Failed to replace line"));
goto end;
}
// Mark lines that haven't been passed to the buffer as they need
@@ -375,12 +375,12 @@ void nvim_buf_set_lines(uint64_t channel_id,
int64_t lnum = start + (int64_t)i - 1;
if (lnum > LONG_MAX) {
- _api_set_error(err, kErrorTypeValidation, _("Index value is too high"));
+ api_set_error(err, kErrorTypeValidation, _("Index value is too high"));
goto end;
}
if (ml_append((linenr_T)lnum, (char_u *)lines[i], 0, false) == FAIL) {
- _api_set_error(err, kErrorTypeException, _("Failed to insert line"));
+ api_set_error(err, kErrorTypeException, _("Failed to insert line"));
goto end;
}
@@ -627,7 +627,7 @@ void nvim_buf_set_name(Buffer buffer, String name, Error *err)
}
if (ren_ret == FAIL) {
- _api_set_error(err, kErrorTypeException, _("Failed to rename buffer"));
+ api_set_error(err, kErrorTypeException, _("Failed to rename buffer"));
}
}
@@ -680,7 +680,7 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err)
}
if (name.size != 1) {
- _api_set_error(err, kErrorTypeValidation, _("Mark name must be a single character"));
+ api_set_error(err, kErrorTypeValidation, _("Mark name must be a single character"));
return rv;
}
@@ -698,7 +698,7 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err)
}
if (posp == NULL) {
- _api_set_error(err, kErrorTypeValidation, _("Invalid mark name"));
+ api_set_error(err, kErrorTypeValidation, _("Invalid mark name"));
return rv;
}
@@ -753,11 +753,11 @@ Integer nvim_buf_add_highlight(Buffer buffer,
}
if (line < 0 || line >= MAXLNUM) {
- _api_set_error(err, kErrorTypeValidation, _("Line number outside range"));
+ api_set_error(err, kErrorTypeValidation, _("Line number outside range"));
return 0;
}
if (col_start < 0 || col_start > MAXCOL) {
- _api_set_error(err, kErrorTypeValidation, _("Column value outside range"));
+ api_set_error(err, kErrorTypeValidation, _("Column value outside range"));
return 0;
}
if (col_end < 0 || col_end > MAXCOL) {
@@ -794,7 +794,7 @@ void nvim_buf_clear_highlight(Buffer buffer,
}
if (line_start < 0 || line_start >= MAXLNUM) {
- _api_set_error(err, kErrorTypeValidation, _("Line number outside range"));
+ api_set_error(err, kErrorTypeValidation, _("Line number outside range"));
return;
}
if (line_end < 0 || line_end > MAXLNUM) {
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index 58534d78a0..d7274920b6 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -61,7 +61,7 @@ bool try_end(Error *err)
discard_current_exception();
}
- _api_set_error(err, kErrorTypeException, _("Keyboard interrupt"));
+ api_set_error(err, kErrorTypeException, _("Keyboard interrupt"));
got_int = false;
} else if (msg_list != NULL && *msg_list != NULL) {
int should_free;
@@ -69,14 +69,14 @@ bool try_end(Error *err)
ET_ERROR,
NULL,
&should_free);
- _api_set_error(err, kErrorTypeException, "%s", msg);
+ api_set_error(err, kErrorTypeException, "%s", msg);
free_global_msglist();
if (should_free) {
xfree(msg);
}
} else if (did_throw) {
- _api_set_error(err, kErrorTypeException, "%s", current_exception->value);
+ api_set_error(err, kErrorTypeException, "%s", current_exception->value);
discard_current_exception();
}
@@ -93,7 +93,7 @@ Object dict_get_value(dict_T *dict, String key, Error *err)
dictitem_T *const di = tv_dict_find(dict, key.data, (ptrdiff_t)key.size);
if (di == NULL) {
- _api_set_error(err, kErrorTypeValidation, _("Key not found"));
+ api_set_error(err, kErrorTypeValidation, _("Key not found"));
return (Object) OBJECT_INIT;
}
@@ -117,17 +117,17 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del,
Object rv = OBJECT_INIT;
if (dict->dv_lock) {
- _api_set_error(err, kErrorTypeException, _("Dictionary is locked"));
+ api_set_error(err, kErrorTypeException, _("Dictionary is locked"));
return rv;
}
if (key.size == 0) {
- _api_set_error(err, kErrorTypeValidation, _("Empty variable names aren't allowed"));
+ api_set_error(err, kErrorTypeValidation, _("Empty variable names aren't allowed"));
return rv;
}
if (key.size > INT_MAX) {
- _api_set_error(err, kErrorTypeValidation, _("Key length is too high"));
+ api_set_error(err, kErrorTypeValidation, _("Key length is too high"));
return rv;
}
@@ -135,13 +135,13 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del,
if (di != NULL) {
if (di->di_flags & DI_FLAGS_RO) {
- _api_set_error(err, kErrorTypeException, _("Key is read-only: %s"), key.data);
+ api_set_error(err, kErrorTypeException, _("Key is read-only: %s"), key.data);
return rv;
} else if (di->di_flags & DI_FLAGS_FIX) {
- _api_set_error(err, kErrorTypeException, _("Key is fixed: %s"), key.data);
+ api_set_error(err, kErrorTypeException, _("Key is fixed: %s"), key.data);
return rv;
} else if (di->di_flags & DI_FLAGS_LOCK) {
- _api_set_error(err, kErrorTypeException, _("Key is locked: %s"), key.data);
+ api_set_error(err, kErrorTypeException, _("Key is locked: %s"), key.data);
return rv;
}
}
@@ -150,7 +150,7 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del,
// Delete the key
if (di == NULL) {
// Doesn't exist, fail
- _api_set_error(err, kErrorTypeValidation, _("Key \"%s\" doesn't exist"), key.data);
+ api_set_error(err, kErrorTypeValidation, _("Key \"%s\" doesn't exist"), key.data);
} else {
// Return the old value
if (retval) {
@@ -202,7 +202,7 @@ Object get_option_from(void *from, int type, String name, Error *err)
Object rv = OBJECT_INIT;
if (name.size == 0) {
- _api_set_error(err, kErrorTypeValidation, _("Empty option name"));
+ api_set_error(err, kErrorTypeValidation, _("Empty option name"));
return rv;
}
@@ -213,7 +213,7 @@ Object get_option_from(void *from, int type, String name, Error *err)
type, from);
if (!flags) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeValidation,
_("Invalid option name \"%s\""),
name.data);
@@ -232,13 +232,13 @@ Object get_option_from(void *from, int type, String name, Error *err)
rv.data.string.data = stringval;
rv.data.string.size = strlen(stringval);
} else {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeException,
_("Unable to get value for option \"%s\""),
name.data);
}
} else {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeException,
_("Unknown type for option \"%s\""),
name.data);
@@ -257,14 +257,14 @@ Object get_option_from(void *from, int type, String name, Error *err)
void set_option_to(void *to, int type, String name, Object value, Error *err)
{
if (name.size == 0) {
- _api_set_error(err, kErrorTypeValidation, _("Empty option name"));
+ api_set_error(err, kErrorTypeValidation, _("Empty option name"));
return;
}
int flags = get_option_value_strict(name.data, NULL, NULL, type, to);
if (flags == 0) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeValidation,
_("Invalid option name \"%s\""),
name.data);
@@ -273,13 +273,13 @@ void set_option_to(void *to, int type, String name, Object value, Error *err)
if (value.type == kObjectTypeNil) {
if (type == SREQ_GLOBAL) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeException,
_("Unable to unset option \"%s\""),
name.data);
return;
} else if (!(flags & SOPT_GLOBAL)) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeException,
_("Cannot unset option \"%s\" "
"because it doesn't have a global value"),
@@ -295,7 +295,7 @@ void set_option_to(void *to, int type, String name, Object value, Error *err)
if (flags & SOPT_BOOL) {
if (value.type != kObjectTypeBoolean) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeValidation,
_("Option \"%s\" requires a boolean value"),
name.data);
@@ -306,7 +306,7 @@ void set_option_to(void *to, int type, String name, Object value, Error *err)
set_option_value_for(name.data, val, NULL, opt_flags, type, to, err);
} else if (flags & SOPT_NUM) {
if (value.type != kObjectTypeInteger) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeValidation,
_("Option \"%s\" requires an integer value"),
name.data);
@@ -314,7 +314,7 @@ void set_option_to(void *to, int type, String name, Object value, Error *err)
}
if (value.data.integer > INT_MAX || value.data.integer < INT_MIN) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeValidation,
_("Value for option \"%s\" is outside range"),
name.data);
@@ -325,7 +325,7 @@ void set_option_to(void *to, int type, String name, Object value, Error *err)
set_option_value_for(name.data, val, NULL, opt_flags, type, to, err);
} else {
if (value.type != kObjectTypeString) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeValidation,
_("Option \"%s\" requires a string value"),
name.data);
@@ -560,7 +560,7 @@ buf_T *find_buffer_by_handle(Buffer buffer, Error *err)
buf_T *rv = handle_get_buffer(buffer);
if (!rv) {
- _api_set_error(err, kErrorTypeValidation, _("Invalid buffer id"));
+ api_set_error(err, kErrorTypeValidation, _("Invalid buffer id"));
}
return rv;
@@ -575,7 +575,7 @@ win_T *find_window_by_handle(Window window, Error *err)
win_T *rv = handle_get_window(window);
if (!rv) {
- _api_set_error(err, kErrorTypeValidation, _("Invalid window id"));
+ api_set_error(err, kErrorTypeValidation, _("Invalid window id"));
}
return rv;
@@ -590,7 +590,7 @@ tabpage_T *find_tab_by_handle(Tabpage tabpage, Error *err)
tabpage_T *rv = handle_get_tabpage(tabpage);
if (!rv) {
- _api_set_error(err, kErrorTypeValidation, _("Invalid tabpage id"));
+ api_set_error(err, kErrorTypeValidation, _("Invalid tabpage id"));
}
return rv;
@@ -658,7 +658,7 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)
case kObjectTypeInteger:
if (obj.data.integer > VARNUMBER_MAX
|| obj.data.integer < VARNUMBER_MIN) {
- _api_set_error(err, kErrorTypeValidation, _("Integer value outside range"));
+ api_set_error(err, kErrorTypeValidation, _("Integer value outside range"));
return false;
}
@@ -712,7 +712,7 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)
String key = item.key;
if (key.size == 0) {
- _api_set_error(err, kErrorTypeValidation,
+ api_set_error(err, kErrorTypeValidation,
_("Empty dictionary keys aren't allowed"));
// cleanup
tv_dict_free(dict);
@@ -936,7 +936,7 @@ static void set_option_value_for(char *key,
if (try_end(err)) {
return;
}
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeException,
_("Problem while switching windows"));
return;
@@ -975,11 +975,11 @@ static void set_option_value_err(char *key,
return;
}
- _api_set_error(err, kErrorTypeException, "%s", errmsg);
+ api_set_error(err, kErrorTypeException, "%s", errmsg);
}
}
-void _api_set_error(Error *err, ErrorType errType, const char *format, ...)
+void api_set_error(Error *err, ErrorType errType, const char *format, ...)
FUNC_ATTR_NONNULL_ALL
{
assert(kErrorTypeNone != errType);
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index 4c39bc57eb..26c0a8119b 100644
--- a/src/nvim/api/ui.c
+++ b/src/nvim/api/ui.c
@@ -55,12 +55,12 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height,
FUNC_API_SINCE(1) FUNC_API_NOEVAL
{
if (pmap_has(uint64_t)(connected_uis, channel_id)) {
- _api_set_error(err, kErrorTypeException, _("UI already attached for channel"));
+ api_set_error(err, kErrorTypeException, _("UI already attached for channel"));
return;
}
if (width <= 0 || height <= 0) {
- _api_set_error(err, kErrorTypeValidation,
+ api_set_error(err, kErrorTypeValidation,
_("Expected width > 0 and height > 0"));
return;
}
@@ -126,7 +126,7 @@ void nvim_ui_detach(uint64_t channel_id, Error *err)
FUNC_API_SINCE(1) FUNC_API_NOEVAL
{
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
- _api_set_error(err, kErrorTypeException, _("UI is not attached for channel"));
+ api_set_error(err, kErrorTypeException, _("UI is not attached for channel"));
return;
}
remote_ui_disconnect(channel_id);
@@ -138,12 +138,12 @@ void nvim_ui_try_resize(uint64_t channel_id, Integer width,
FUNC_API_SINCE(1) FUNC_API_NOEVAL
{
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
- _api_set_error(err, kErrorTypeException, _("UI is not attached for channel"));
+ api_set_error(err, kErrorTypeException, _("UI is not attached for channel"));
return;
}
if (width <= 0 || height <= 0) {
- _api_set_error(err, kErrorTypeValidation,
+ api_set_error(err, kErrorTypeValidation,
_("Expected width > 0 and height > 0"));
return;
}
@@ -159,7 +159,7 @@ void nvim_ui_set_option(uint64_t channel_id, String name,
FUNC_API_SINCE(1) FUNC_API_NOEVAL
{
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
- _api_set_error(error, kErrorTypeException, _("UI is not attached for channel"));
+ api_set_error(error, kErrorTypeException, _("UI is not attached for channel"));
return;
}
UI *ui = pmap_get(uint64_t)(connected_uis, channel_id);
@@ -173,19 +173,19 @@ void nvim_ui_set_option(uint64_t channel_id, String name,
static void ui_set_option(UI *ui, String name, Object value, Error *error) {
if (strcmp(name.data, "rgb") == 0) {
if (value.type != kObjectTypeBoolean) {
- _api_set_error(error, kErrorTypeValidation, _("rgb must be a Boolean"));
+ api_set_error(error, kErrorTypeValidation, _("rgb must be a Boolean"));
return;
}
ui->rgb = value.data.boolean;
} else if (strcmp(name.data, "popupmenu_external") == 0) {
if (value.type != kObjectTypeBoolean) {
- _api_set_error(error, kErrorTypeValidation,
+ api_set_error(error, kErrorTypeValidation,
_("popupmenu_external must be a Boolean"));
return;
}
ui->pum_external = value.data.boolean;
} else {
- _api_set_error(error, kErrorTypeValidation, _("No such ui option"));
+ api_set_error(error, kErrorTypeValidation, _("No such ui option"));
}
}
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 924ea419a1..16c630b0e6 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -188,7 +188,7 @@ Object nvim_eval(String expr, Error *err)
typval_T rettv;
if (eval0((char_u *)expr.data, &rettv, NULL, true) == FAIL) {
- _api_set_error(err, kErrorTypeException, "Failed to evaluate expression");
+ api_set_error(err, kErrorTypeException, "Failed to evaluate expression");
}
if (!try_end(err)) {
@@ -214,7 +214,7 @@ Object nvim_call_function(String fname, Array args, Error *err)
{
Object rv = OBJECT_INIT;
if (args.size > MAX_FUNC_ARGS) {
- _api_set_error(err, kErrorTypeValidation,
+ api_set_error(err, kErrorTypeValidation,
_("Function called with too many arguments."));
return rv;
}
@@ -237,7 +237,7 @@ Object nvim_call_function(String fname, Array args, Error *err)
curwin->w_cursor.lnum, curwin->w_cursor.lnum, &dummy,
true, NULL, NULL);
if (r == FAIL) {
- _api_set_error(err, kErrorTypeException, _("Error calling function."));
+ api_set_error(err, kErrorTypeException, _("Error calling function."));
}
if (!try_end(err)) {
rv = vim_to_object(&rettv);
@@ -262,7 +262,7 @@ Integer nvim_strwidth(String str, Error *err)
FUNC_API_SINCE(1)
{
if (str.size > INT_MAX) {
- _api_set_error(err, kErrorTypeValidation, _("String length is too high"));
+ api_set_error(err, kErrorTypeValidation, _("String length is too high"));
return 0;
}
@@ -318,7 +318,7 @@ void nvim_set_current_dir(String dir, Error *err)
FUNC_API_SINCE(1)
{
if (dir.size >= MAXPATHL) {
- _api_set_error(err, kErrorTypeValidation, _("Directory string is too long"));
+ api_set_error(err, kErrorTypeValidation, _("Directory string is too long"));
return;
}
@@ -330,7 +330,7 @@ void nvim_set_current_dir(String dir, Error *err)
if (vim_chdir((char_u *)string, kCdScopeGlobal)) {
if (!try_end(err)) {
- _api_set_error(err, kErrorTypeException, _("Failed to change directory"));
+ api_set_error(err, kErrorTypeException, _("Failed to change directory"));
}
return;
}
@@ -538,7 +538,7 @@ void nvim_set_current_buf(Buffer buffer, Error *err)
try_start();
int result = do_buffer(DOBUF_GOTO, DOBUF_FIRST, FORWARD, buf->b_fnum, 0);
if (!try_end(err) && result == FAIL) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeException,
_("Failed to switch to buffer %d"),
buffer);
@@ -591,7 +591,7 @@ void nvim_set_current_win(Window window, Error *err)
try_start();
goto_tabpage_win(win_find_tabpage(win), win);
if (!try_end(err) && win != curwin) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeException,
_("Failed to switch to window %d"),
window);
@@ -645,7 +645,7 @@ void nvim_set_current_tabpage(Tabpage tabpage, Error *err)
try_start();
goto_tabpage_tp(tp, true, true);
if (!try_end(err) && tp != curtab) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeException,
_("Failed to switch to tabpage %d"),
tabpage);
@@ -744,21 +744,21 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err)
size_t i; // also used for freeing the variables
for (i = 0; i < calls.size; i++) {
if (calls.items[i].type != kObjectTypeArray) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeValidation,
_("All items in calls array must be arrays"));
goto validation_error;
}
Array call = calls.items[i].data.array;
if (call.size != 2) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeValidation,
_("All items in calls array must be arrays of size 2"));
goto validation_error;
}
if (call.items[0].type != kObjectTypeString) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeValidation,
_("name must be String"));
goto validation_error;
@@ -766,7 +766,7 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err)
String name = call.items[0].data.string;
if (call.items[1].type != kObjectTypeArray) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeValidation,
_("args must be Array"));
goto validation_error;
diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c
index b8326c1198..dd52b2d690 100644
--- a/src/nvim/api/window.c
+++ b/src/nvim/api/window.c
@@ -64,7 +64,7 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)
if (pos.size != 2 || pos.items[0].type != kObjectTypeInteger
|| pos.items[1].type != kObjectTypeInteger) {
- _api_set_error(err,
+ api_set_error(err,
kErrorTypeValidation,
_("Argument \"pos\" must be a [row, col] array"));
return;
@@ -78,12 +78,12 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)
int64_t col = pos.items[1].data.integer;
if (row <= 0 || row > win->w_buffer->b_ml.ml_line_count) {
- _api_set_error(err, kErrorTypeValidation, _("Cursor position outside buffer"));
+ api_set_error(err, kErrorTypeValidation, _("Cursor position outside buffer"));
return;
}
if (col > MAXCOL || col < 0) {
- _api_set_error(err, kErrorTypeValidation, _("Column value outside range"));
+ api_set_error(err, kErrorTypeValidation, _("Column value outside range"));
return;
}
@@ -132,7 +132,7 @@ void nvim_win_set_height(Window window, Integer height, Error *err)
}
if (height > INT_MAX || height < INT_MIN) {
- _api_set_error(err, kErrorTypeValidation, _("Height value outside range"));
+ api_set_error(err, kErrorTypeValidation, _("Height value outside range"));
return;
}
@@ -177,7 +177,7 @@ void nvim_win_set_width(Window window, Integer width, Error *err)
}
if (width > INT_MAX || width < INT_MIN) {
- _api_set_error(err, kErrorTypeValidation, _("Width value outside range"));
+ api_set_error(err, kErrorTypeValidation, _("Width value outside range"));
return;
}
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c
index 36a3210c70..3cf85316d9 100644
--- a/src/nvim/msgpack_rpc/channel.c
+++ b/src/nvim/msgpack_rpc/channel.c
@@ -192,7 +192,7 @@ Object channel_send_call(uint64_t id,
Channel *channel = NULL;
if (!(channel = pmap_get(uint64_t)(channels, id)) || channel->closed) {
- _api_set_error(err, kErrorTypeException, _("Invalid channel \"%" PRIu64 "\""), id);
+ api_set_error(err, kErrorTypeException, _("Invalid channel \"%" PRIu64 "\""), id);
api_free_array(args);
return NIL;
}
@@ -212,7 +212,7 @@ Object channel_send_call(uint64_t id,
if (frame.errored) {
if (frame.result.type == kObjectTypeString) {
- _api_set_error(err, kErrorTypeException, "%s", frame.result.data.string.data);
+ api_set_error(err, kErrorTypeException, "%s", frame.result.data.string.data);
} else if (frame.result.type == kObjectTypeArray) {
// Should be an error in the form [type, message]
Array array = frame.result.data.array;
@@ -220,13 +220,13 @@ Object channel_send_call(uint64_t id,
&& (array.items[0].data.integer == kErrorTypeException
|| array.items[0].data.integer == kErrorTypeValidation)
&& array.items[1].type == kObjectTypeString) {
- _api_set_error(err, (ErrorType)array.items[0].data.integer, "%s",
+ api_set_error(err, (ErrorType)array.items[0].data.integer, "%s",
array.items[1].data.string.data);
} else {
- _api_set_error(err, kErrorTypeException, "%s", "unknown error");
+ api_set_error(err, kErrorTypeException, "%s", "unknown error");
}
} else {
- _api_set_error(err, kErrorTypeException, "%s", "unknown error");
+ api_set_error(err, kErrorTypeException, "%s", "unknown error");
}
api_free_object(frame.result);
@@ -512,7 +512,7 @@ static bool channel_write(Channel *channel, WBuffer *buffer)
static void send_error(Channel *channel, uint64_t id, char *err)
{
Error e = ERROR_INIT;
- _api_set_error(&e, kErrorTypeException, "%s", err);
+ api_set_error(&e, kErrorTypeException, "%s", err);
channel_write(channel, serialize_response(channel->id,
id,
&e,
diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c
index 800f5edb85..0ad1d9ae4b 100644
--- a/src/nvim/msgpack_rpc/helpers.c
+++ b/src/nvim/msgpack_rpc/helpers.c
@@ -475,7 +475,7 @@ Object msgpack_rpc_handle_missing_method(uint64_t channel_id,
Array args,
Error *error)
{
- _api_set_error(error, kErrorTypeException, "Invalid method name");
+ api_set_error(error, kErrorTypeException, "Invalid method name");
return NIL;
}
@@ -484,7 +484,7 @@ Object msgpack_rpc_handle_invalid_arguments(uint64_t channel_id,
Array args,
Error *error)
{
- _api_set_error(error, kErrorTypeException, "Invalid method arguments");
+ api_set_error(error, kErrorTypeException, "Invalid method arguments");
return NIL;
}
@@ -570,29 +570,29 @@ void msgpack_rpc_validate(uint64_t *response_id,
*response_id = NO_RESPONSE;
// Validate the basic structure of the msgpack-rpc payload
if (req->type != MSGPACK_OBJECT_ARRAY) {
- _api_set_error(err, kErrorTypeValidation, _("Message is not an array"));
+ api_set_error(err, kErrorTypeValidation, _("Message is not an array"));
return;
}
if (req->via.array.size == 0) {
- _api_set_error(err, kErrorTypeValidation, _("Message is empty"));
+ api_set_error(err, kErrorTypeValidation, _("Message is empty"));
return;
}
if (req->via.array.ptr[0].type != MSGPACK_OBJECT_POSITIVE_INTEGER) {
- _api_set_error(err, kErrorTypeValidation, _("Message type must be an integer"));
+ api_set_error(err, kErrorTypeValidation, _("Message type must be an integer"));
return;
}
uint64_t type = req->via.array.ptr[0].via.u64;
if (type != kMessageTypeRequest && type != kMessageTypeNotification) {
- _api_set_error(err, kErrorTypeValidation, _("Unknown message type"));
+ api_set_error(err, kErrorTypeValidation, _("Unknown message type"));
return;
}
if ((type == kMessageTypeRequest && req->via.array.size != 4)
|| (type == kMessageTypeNotification && req->via.array.size != 3)) {
- _api_set_error(err, kErrorTypeValidation, _("Request array size should be 4 (request) "
+ api_set_error(err, kErrorTypeValidation, _("Request array size should be 4 (request) "
"or 3 (notification)"));
return;
}
@@ -600,19 +600,19 @@ void msgpack_rpc_validate(uint64_t *response_id,
if (type == kMessageTypeRequest) {
msgpack_object *id_obj = msgpack_rpc_msg_id(req);
if (!id_obj) {
- _api_set_error(err, kErrorTypeValidation, _("ID must be a positive integer"));
+ api_set_error(err, kErrorTypeValidation, _("ID must be a positive integer"));
return;
}
*response_id = id_obj->via.u64;
}
if (!msgpack_rpc_method(req)) {
- _api_set_error(err, kErrorTypeValidation, _("Method must be a string"));
+ api_set_error(err, kErrorTypeValidation, _("Method must be a string"));
return;
}
if (!msgpack_rpc_args(req)) {
- _api_set_error(err, kErrorTypeValidation, _("Parameters must be an array"));
+ api_set_error(err, kErrorTypeValidation, _("Parameters must be an array"));
return;
}
}