mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 06:18:16 +00:00
*: Fix linter errors
This commit is contained in:
@@ -1540,7 +1540,8 @@ ex_let_vars (
|
|||||||
listitem_T *item = tv_list_first(l);
|
listitem_T *item = tv_list_first(l);
|
||||||
while (*arg != ']') {
|
while (*arg != ']') {
|
||||||
arg = skipwhite(arg + 1);
|
arg = skipwhite(arg + 1);
|
||||||
arg = ex_let_one(arg, TV_LIST_ITEM_TV(item), TRUE, (char_u *)",;]", nextchars);
|
arg = ex_let_one(arg, TV_LIST_ITEM_TV(item), true, (const char_u *)",;]",
|
||||||
|
nextchars);
|
||||||
item = TV_LIST_ITEM_NEXT(l, item);
|
item = TV_LIST_ITEM_NEXT(l, item);
|
||||||
if (arg == NULL) {
|
if (arg == NULL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@@ -2415,13 +2416,14 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv,
|
|||||||
lp->ll_li = TV_LIST_ITEM_NEXT(lp->ll_list, lp->ll_li);
|
lp->ll_li = TV_LIST_ITEM_NEXT(lp->ll_list, lp->ll_li);
|
||||||
lp->ll_n1++;
|
lp->ll_n1++;
|
||||||
}
|
}
|
||||||
if (ri != NULL)
|
if (ri != NULL) {
|
||||||
EMSG(_("E710: List value has more items than target"));
|
EMSG(_("E710: List value has more items than target"));
|
||||||
else if (lp->ll_empty2
|
} else if (lp->ll_empty2
|
||||||
? (lp->ll_li != NULL
|
? (lp->ll_li != NULL
|
||||||
&& TV_LIST_ITEM_NEXT(lp->ll_list, lp->ll_li) != NULL)
|
&& TV_LIST_ITEM_NEXT(lp->ll_list, lp->ll_li) != NULL)
|
||||||
: lp->ll_n1 != lp->ll_n2)
|
: lp->ll_n1 != lp->ll_n2) {
|
||||||
EMSG(_("E711: List value has not enough items"));
|
EMSG(_("E711: List value has not enough items"));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
typval_T oldtv = TV_INITIAL_VALUE;
|
typval_T oldtv = TV_INITIAL_VALUE;
|
||||||
dict_T *dict = lp->ll_dict;
|
dict_T *dict = lp->ll_dict;
|
||||||
@@ -8561,8 +8563,9 @@ static void filter_map(typval_T *argvars, typval_T *rettv, int map)
|
|||||||
nli = TV_LIST_ITEM_NEXT(l, li);
|
nli = TV_LIST_ITEM_NEXT(l, li);
|
||||||
vimvars[VV_KEY].vv_nr = idx;
|
vimvars[VV_KEY].vv_nr = idx;
|
||||||
if (filter_map_one(TV_LIST_ITEM_TV(li), expr, map, &rem) == FAIL
|
if (filter_map_one(TV_LIST_ITEM_TV(li), expr, map, &rem) == FAIL
|
||||||
|| did_emsg)
|
|| did_emsg) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
if (!map && rem) {
|
if (!map && rem) {
|
||||||
tv_list_item_remove(l, li);
|
tv_list_item_remove(l, li);
|
||||||
}
|
}
|
||||||
@@ -19235,9 +19238,9 @@ int var_item_copy(const vimconv_T *const conv,
|
|||||||
case VAR_LIST:
|
case VAR_LIST:
|
||||||
to->v_type = VAR_LIST;
|
to->v_type = VAR_LIST;
|
||||||
to->v_lock = 0;
|
to->v_lock = 0;
|
||||||
if (from->vval.v_list == NULL)
|
if (from->vval.v_list == NULL) {
|
||||||
to->vval.v_list = NULL;
|
to->vval.v_list = NULL;
|
||||||
else if (copyID != 0 && tv_list_copyid(from->vval.v_list) == copyID) {
|
} else if (copyID != 0 && tv_list_copyid(from->vval.v_list) == copyID) {
|
||||||
// Use the copy made earlier.
|
// Use the copy made earlier.
|
||||||
to->vval.v_list = tv_list_latest_copy(from->vval.v_list);
|
to->vval.v_list = tv_list_latest_copy(from->vval.v_list);
|
||||||
tv_list_ref(to->vval.v_list);
|
tv_list_ref(to->vval.v_list);
|
||||||
@@ -22400,7 +22403,7 @@ typval_T eval_call_provider(char *provider, char *method, list_T *arguments)
|
|||||||
{.v_type = VAR_LIST, .vval.v_list = arguments, .v_lock = 0},
|
{.v_type = VAR_LIST, .vval.v_list = arguments, .v_lock = 0},
|
||||||
{.v_type = VAR_UNKNOWN}
|
{.v_type = VAR_UNKNOWN}
|
||||||
};
|
};
|
||||||
typval_T rettv = {.v_type = VAR_UNKNOWN, .v_lock = 0};
|
typval_T rettv = { .v_type = VAR_UNKNOWN, .v_lock = VAR_UNLOCKED };
|
||||||
tv_list_ref(arguments);
|
tv_list_ref(arguments);
|
||||||
|
|
||||||
int dummy;
|
int dummy;
|
||||||
|
@@ -60,7 +60,7 @@ static inline void create_special_dict(typval_T *const rettv,
|
|||||||
dictitem_T *const type_di = tv_dict_item_alloc_len(S_LEN("_TYPE"));
|
dictitem_T *const type_di = tv_dict_item_alloc_len(S_LEN("_TYPE"));
|
||||||
type_di->di_tv.v_type = VAR_LIST;
|
type_di->di_tv.v_type = VAR_LIST;
|
||||||
type_di->di_tv.v_lock = VAR_UNLOCKED;
|
type_di->di_tv.v_lock = VAR_UNLOCKED;
|
||||||
type_di->di_tv.vval.v_list = (list_T *) eval_msgpack_type_lists[type];
|
type_di->di_tv.vval.v_list = (list_T *)eval_msgpack_type_lists[type];
|
||||||
tv_list_ref(type_di->di_tv.vval.v_list);
|
tv_list_ref(type_di->di_tv.vval.v_list);
|
||||||
tv_dict_add(dict, type_di);
|
tv_dict_add(dict, type_di);
|
||||||
dictitem_T *const val_di = tv_dict_item_alloc_len(S_LEN("_VAL"));
|
dictitem_T *const val_di = tv_dict_item_alloc_len(S_LEN("_VAL"));
|
||||||
|
@@ -267,7 +267,7 @@ int encode_read_from_list(ListReaderState *const state, char *const buf,
|
|||||||
}
|
}
|
||||||
*p++ = NL;
|
*p++ = NL;
|
||||||
if (TV_LIST_ITEM_TV(state->li)->v_type != VAR_STRING) {
|
if (TV_LIST_ITEM_TV(state->li)->v_type != VAR_STRING) {
|
||||||
*read_bytes = (size_t) (p - buf);
|
*read_bytes = (size_t)(p - buf);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
state->offset = 0;
|
state->offset = 0;
|
||||||
|
@@ -696,8 +696,8 @@ bool tv_list_equal(list_T *const l1, list_T *const l2, const bool ic,
|
|||||||
listitem_T *item1 = tv_list_first(l1);
|
listitem_T *item1 = tv_list_first(l1);
|
||||||
listitem_T *item2 = tv_list_first(l2);
|
listitem_T *item2 = tv_list_first(l2);
|
||||||
for (; item1 != NULL && item2 != NULL
|
for (; item1 != NULL && item2 != NULL
|
||||||
; item1 = TV_LIST_ITEM_NEXT(l1, item1),
|
; (item1 = TV_LIST_ITEM_NEXT(l1, item1),
|
||||||
item2 = TV_LIST_ITEM_NEXT(n2, item2)) {
|
item2 = TV_LIST_ITEM_NEXT(n2, item2))) {
|
||||||
if (!tv_equal(TV_LIST_ITEM_TV(item1), TV_LIST_ITEM_TV(item2), ic,
|
if (!tv_equal(TV_LIST_ITEM_TV(item1), TV_LIST_ITEM_TV(item2), ic,
|
||||||
recursive)) {
|
recursive)) {
|
||||||
return false;
|
return false;
|
||||||
|
@@ -586,9 +586,10 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
|
|||||||
}
|
}
|
||||||
size_t len;
|
size_t len;
|
||||||
char *buf;
|
char *buf;
|
||||||
if (!encode_vim_list_to_buf(
|
if (!(
|
||||||
|
encode_vim_list_to_buf(
|
||||||
TV_LIST_ITEM_TV(tv_list_last(val_list))->vval.v_list, &len,
|
TV_LIST_ITEM_TV(tv_list_last(val_list))->vval.v_list, &len,
|
||||||
&buf)) {
|
&buf))) {
|
||||||
goto _convert_one_value_regular_dict;
|
goto _convert_one_value_regular_dict;
|
||||||
}
|
}
|
||||||
TYPVAL_ENCODE_CONV_EXT_STRING(tv, buf, len, type);
|
TYPVAL_ENCODE_CONV_EXT_STRING(tv, buf, len, type);
|
||||||
@@ -721,7 +722,8 @@ typval_encode_stop_converting_one_item:
|
|||||||
TV_LIST_ITEM_TV(cur_mpsv->data.l.li)->vval.v_list);
|
TV_LIST_ITEM_TV(cur_mpsv->data.l.li)->vval.v_list);
|
||||||
TYPVAL_ENCODE_SPECIAL_DICT_KEY_CHECK(
|
TYPVAL_ENCODE_SPECIAL_DICT_KEY_CHECK(
|
||||||
encode_vim_to__error_ret, *TV_LIST_ITEM_TV(tv_list_first(kv_pair)));
|
encode_vim_to__error_ret, *TV_LIST_ITEM_TV(tv_list_first(kv_pair)));
|
||||||
if (_TYPVAL_ENCODE_CONVERT_ONE_VALUE(
|
if (
|
||||||
|
_TYPVAL_ENCODE_CONVERT_ONE_VALUE(
|
||||||
TYPVAL_ENCODE_FIRST_ARG_NAME, &mpstack, cur_mpsv,
|
TYPVAL_ENCODE_FIRST_ARG_NAME, &mpstack, cur_mpsv,
|
||||||
TV_LIST_ITEM_TV(tv_list_first(kv_pair)), copyID, objname)
|
TV_LIST_ITEM_TV(tv_list_first(kv_pair)), copyID, objname)
|
||||||
== FAIL) {
|
== FAIL) {
|
||||||
|
@@ -5616,7 +5616,7 @@ static bool get_clipboard(int name, yankreg_T **target, bool quiet)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
char_u *regtype = TV_LIST_ITEM_TV(tv_list_last(res))->vval.v_string;
|
char_u *regtype = TV_LIST_ITEM_TV(tv_list_last(res))->vval.v_string;
|
||||||
if (regtype == NULL || strlen((char*)regtype) > 1) {
|
if (regtype == NULL || strlen((char *)regtype) > 1) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
switch (regtype[0]) {
|
switch (regtype[0]) {
|
||||||
|
@@ -1646,20 +1646,20 @@ static ShaDaWriteResult shada_pack_entry(msgpack_packer *const packer,
|
|||||||
case kSDItemHistoryEntry: {
|
case kSDItemHistoryEntry: {
|
||||||
const bool is_hist_search =
|
const bool is_hist_search =
|
||||||
entry.data.history_item.histtype == HIST_SEARCH;
|
entry.data.history_item.histtype == HIST_SEARCH;
|
||||||
const size_t arr_size = 2 + (size_t) is_hist_search + (size_t) (
|
const size_t arr_size = 2 + (size_t)is_hist_search + (size_t)(
|
||||||
tv_list_len(entry.data.history_item.additional_elements));
|
tv_list_len(entry.data.history_item.additional_elements));
|
||||||
msgpack_pack_array(spacker, arr_size);
|
msgpack_pack_array(spacker, arr_size);
|
||||||
msgpack_pack_uint8(spacker, entry.data.history_item.histtype);
|
msgpack_pack_uint8(spacker, entry.data.history_item.histtype);
|
||||||
PACK_BIN(cstr_as_string(entry.data.history_item.string));
|
PACK_BIN(cstr_as_string(entry.data.history_item.string));
|
||||||
if (is_hist_search) {
|
if (is_hist_search) {
|
||||||
msgpack_pack_uint8(spacker, (uint8_t) entry.data.history_item.sep);
|
msgpack_pack_uint8(spacker, (uint8_t)entry.data.history_item.sep);
|
||||||
}
|
}
|
||||||
DUMP_ADDITIONAL_ELEMENTS(entry.data.history_item.additional_elements,
|
DUMP_ADDITIONAL_ELEMENTS(entry.data.history_item.additional_elements,
|
||||||
"history entry item");
|
"history entry item");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kSDItemVariable: {
|
case kSDItemVariable: {
|
||||||
const size_t arr_size = 2 + (size_t) (
|
const size_t arr_size = 2 + (size_t)(
|
||||||
tv_list_len(entry.data.global_var.additional_elements));
|
tv_list_len(entry.data.global_var.additional_elements));
|
||||||
msgpack_pack_array(spacker, arr_size);
|
msgpack_pack_array(spacker, arr_size);
|
||||||
const String varname = cstr_as_string(entry.data.global_var.name);
|
const String varname = cstr_as_string(entry.data.global_var.name);
|
||||||
@@ -1679,7 +1679,7 @@ static ShaDaWriteResult shada_pack_entry(msgpack_packer *const packer,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kSDItemSubString: {
|
case kSDItemSubString: {
|
||||||
const size_t arr_size = 1 + (size_t) (
|
const size_t arr_size = 1 + (size_t)(
|
||||||
tv_list_len(entry.data.sub_string.additional_elements));
|
tv_list_len(entry.data.sub_string.additional_elements));
|
||||||
msgpack_pack_array(spacker, arr_size);
|
msgpack_pack_array(spacker, arr_size);
|
||||||
PACK_BIN(cstr_as_string(entry.data.sub_string.sub));
|
PACK_BIN(cstr_as_string(entry.data.sub_string.sub));
|
||||||
|
@@ -5577,8 +5577,7 @@ int match_add(win_T *wp, const char *const grp, const char *const pat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up position matches
|
// Set up position matches
|
||||||
if (pos_list != NULL)
|
if (pos_list != NULL) {
|
||||||
{
|
|
||||||
linenr_T toplnum = 0;
|
linenr_T toplnum = 0;
|
||||||
linenr_T botlnum = 0;
|
linenr_T botlnum = 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user