mirror of
https://github.com/neovim/neovim.git
synced 2025-10-02 16:08:36 +00:00
Merge pull request #17143 from jamessan/coverity-fixes
Various Coverity fixes
This commit is contained in:
@@ -233,6 +233,7 @@ Object vim_to_object(typval_T *obj)
|
|||||||
{
|
{
|
||||||
if (obj->v_type == VAR_FUNC) {
|
if (obj->v_type == VAR_FUNC) {
|
||||||
ufunc_T *fp = find_func(obj->vval.v_string);
|
ufunc_T *fp = find_func(obj->vval.v_string);
|
||||||
|
assert(fp != NULL);
|
||||||
if (fp->uf_cb == nlua_CFunction_func_call) {
|
if (fp->uf_cb == nlua_CFunction_func_call) {
|
||||||
LuaRef ref = api_new_luaref(((LuaCFunctionState *)fp->uf_cb_state)->lua_callable.func_ref);
|
LuaRef ref = api_new_luaref(((LuaCFunctionState *)fp->uf_cb_state)->lua_callable.func_ref);
|
||||||
return LUAREF_OBJ(ref);
|
return LUAREF_OBJ(ref);
|
||||||
|
@@ -2283,6 +2283,11 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error *
|
|||||||
fillchar = ' ';
|
fillchar = ' ';
|
||||||
} else {
|
} else {
|
||||||
wp = find_window_by_handle(window, err);
|
wp = find_window_by_handle(window, err);
|
||||||
|
|
||||||
|
if (wp == NULL) {
|
||||||
|
api_set_error(err, kErrorTypeException, "unknown winid %d", window);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
ewp = wp;
|
ewp = wp;
|
||||||
|
|
||||||
if (fillchar == 0) {
|
if (fillchar == 0) {
|
||||||
|
@@ -4351,7 +4351,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
|
|||||||
// Only free the string buffer if we allocated it.
|
// Only free the string buffer if we allocated it.
|
||||||
// Note: This is not needed if `str` is pointing at `tmp`
|
// Note: This is not needed if `str` is pointing at `tmp`
|
||||||
if (opt == STL_VIM_EXPR) {
|
if (opt == STL_VIM_EXPR) {
|
||||||
xfree(str);
|
XFREE_CLEAR(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num >= 0 || (!itemisflag && str && *str)) {
|
if (num >= 0 || (!itemisflag && str && *str)) {
|
||||||
|
@@ -619,6 +619,7 @@ bool nlua_push_typval(lua_State *lstate, typval_T *const tv, bool special)
|
|||||||
}
|
}
|
||||||
if (tv->v_type == VAR_FUNC) {
|
if (tv->v_type == VAR_FUNC) {
|
||||||
ufunc_T *fp = find_func(tv->vval.v_string);
|
ufunc_T *fp = find_func(tv->vval.v_string);
|
||||||
|
assert(fp != NULL);
|
||||||
if (fp->uf_cb == nlua_CFunction_func_call) {
|
if (fp->uf_cb == nlua_CFunction_func_call) {
|
||||||
nlua_pushref(lstate, ((LuaCFunctionState *)fp->uf_cb_state)->lua_callable.func_ref);
|
nlua_pushref(lstate, ((LuaCFunctionState *)fp->uf_cb_state)->lua_callable.func_ref);
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user