mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 22:18:33 +00:00
api_clear_error()
This commit is contained in:
@@ -640,7 +640,7 @@ Boolean nvim_buf_is_valid(Buffer buffer)
|
||||
{
|
||||
Error stub = ERROR_INIT;
|
||||
Boolean ret = find_buffer_by_handle(buffer, &stub) != NULL;
|
||||
xfree(stub.msg);
|
||||
api_clear_error(&stub);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -800,7 +800,8 @@ void api_free_dictionary(Dictionary value)
|
||||
xfree(value.items);
|
||||
}
|
||||
|
||||
void api_free_error(Error *value)
|
||||
void api_clear_error(Error *value)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
xfree(value->msg);
|
||||
value->msg = NULL;
|
||||
|
@@ -194,7 +194,7 @@ Boolean nvim_tabpage_is_valid(Tabpage tabpage)
|
||||
{
|
||||
Error stub = ERROR_INIT;
|
||||
Boolean ret = find_tab_by_handle(tabpage, &stub) != NULL;
|
||||
xfree(stub.msg);
|
||||
api_clear_error(&stub);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -799,7 +799,7 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err)
|
||||
validation_error:
|
||||
api_free_array(results);
|
||||
theend:
|
||||
api_free_error(&nested_error);
|
||||
api_clear_error(&nested_error);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@@ -388,7 +388,7 @@ Boolean nvim_win_is_valid(Window window)
|
||||
{
|
||||
Error stub = ERROR_INIT;
|
||||
Boolean ret = find_window_by_handle(window, &stub) != NULL;
|
||||
xfree(stub.msg);
|
||||
api_clear_error(&stub);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -6524,7 +6524,7 @@ static void api_wrapper(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
end:
|
||||
api_free_array(args);
|
||||
api_free_object(result);
|
||||
xfree(err.msg);
|
||||
api_clear_error(&err);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -13795,7 +13795,7 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
|
||||
end:
|
||||
api_free_object(result);
|
||||
xfree(err.msg);
|
||||
api_clear_error(&err);
|
||||
}
|
||||
|
||||
// "rpcstart()" function (DEPRECATED)
|
||||
@@ -16528,13 +16528,14 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
Error err = ERROR_INIT;
|
||||
dict_set_var(curbuf->b_vars, cstr_as_string("terminal_job_id"),
|
||||
INTEGER_OBJ(rettv->vval.v_number), false, false, &err);
|
||||
api_clear_error(&err);
|
||||
dict_set_var(curbuf->b_vars, cstr_as_string("terminal_job_pid"),
|
||||
INTEGER_OBJ(pid), false, false, &err);
|
||||
api_clear_error(&err);
|
||||
|
||||
Terminal *term = terminal_open(topts);
|
||||
data->term = term;
|
||||
data->refcount++;
|
||||
xfree(err.msg);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@@ -411,7 +411,9 @@ static void handle_request(Channel *channel, msgpack_object *request)
|
||||
channel->id);
|
||||
call_set_error(channel, buf);
|
||||
}
|
||||
} else {
|
||||
api_clear_error(&error);
|
||||
return;
|
||||
}
|
||||
// Retrieve the request handler
|
||||
MsgpackRpcRequestHandler handler;
|
||||
msgpack_object *method = msgpack_rpc_method(request);
|
||||
@@ -441,8 +443,6 @@ static void handle_request(Channel *channel, msgpack_object *request)
|
||||
} else {
|
||||
multiqueue_put(channel->events, on_request_event, 1, event_data);
|
||||
}
|
||||
}
|
||||
xfree(error.msg);
|
||||
}
|
||||
|
||||
static void on_request_event(void **argv)
|
||||
@@ -469,7 +469,7 @@ static void on_request_event(void **argv)
|
||||
api_free_array(args);
|
||||
decref(channel);
|
||||
xfree(e);
|
||||
xfree(error.msg);
|
||||
api_clear_error(&error);
|
||||
}
|
||||
|
||||
static bool channel_write(Channel *channel, WBuffer *buffer)
|
||||
@@ -518,7 +518,7 @@ static void send_error(Channel *channel, uint64_t id, char *err)
|
||||
&e,
|
||||
NIL,
|
||||
&out_buffer));
|
||||
xfree(e.msg);
|
||||
api_clear_error(&e);
|
||||
}
|
||||
|
||||
static void send_request(Channel *channel,
|
||||
|
@@ -640,7 +640,7 @@ static void buf_set_term_title(buf_T *buf, char *title)
|
||||
false,
|
||||
false,
|
||||
&err);
|
||||
xfree(err.msg);
|
||||
api_clear_error(&err);
|
||||
}
|
||||
|
||||
static int term_settermprop(VTermProp prop, VTermValue *val, void *data)
|
||||
@@ -1225,11 +1225,10 @@ static bool is_focused(Terminal *term)
|
||||
/* Only called from terminal_open where curbuf->terminal is the */ \
|
||||
/* context */ \
|
||||
o = dict_get_value(curbuf->b_vars, cstr_as_string(k), &err); \
|
||||
xfree(err.msg); \
|
||||
api_clear_error(&err); \
|
||||
if (o.type == kObjectTypeNil) { \
|
||||
Error err2 = ERROR_INIT; \
|
||||
o = dict_get_value(&globvardict, cstr_as_string(k), &err2); \
|
||||
xfree(err2.msg); \
|
||||
o = dict_get_value(&globvardict, cstr_as_string(k), &err); \
|
||||
api_clear_error(&err); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
@@ -228,7 +228,7 @@ static int get_key_code_timeout(void)
|
||||
if (nvim_get_option(cstr_as_string("ttimeout"), &err).data.boolean) {
|
||||
ms = nvim_get_option(cstr_as_string("ttimeoutlen"), &err).data.integer;
|
||||
}
|
||||
xfree(err.msg);
|
||||
api_clear_error(&err);
|
||||
return (int)ms;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user