refactor: fix clang/PVS warnings (#24213)

This commit is contained in:
zeertzjq 2023-06-30 21:13:08 +08:00 committed by GitHub
parent d191bdf9d5
commit 2493815290
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -709,7 +709,7 @@ static void set_option_to(uint64_t channel_id, void *to, int type, String name,
}
}
OptVal optval = NIL_OPTVAL;
OptVal optval;
if (flags & SOPT_BOOL) {
VALIDATE(value.type == kObjectTypeBoolean, "Option '%s' value must be Boolean", name.data, {

View File

@ -735,10 +735,10 @@ static void get_statuscol_display_info(statuscol_T *stcp, winlinevars_T *wlv)
wlv->draw_state = WL_STC;
wlv->char_attr = stcp->cur_attr;
wlv->p_extra = stcp->textp;
wlv->n_extra =
(int)((stcp->hlrecp->start ? stcp->hlrecp->start : stcp->text_end) - stcp->textp);
char *const section_end = stcp->hlrecp->start ? stcp->hlrecp->start : stcp->text_end;
wlv->n_extra = (int)(section_end - stcp->textp);
// Prepare for next highlight section if not yet at the end
if (stcp->textp + wlv->n_extra < stcp->text_end) {
if (section_end < stcp->text_end) {
int hl = stcp->hlrecp->userhl;
stcp->textp = stcp->hlrecp->start;
stcp->cur_attr = hl < 0 ? syn_id2attr(-hl) : stcp->num_attr;

View File

@ -673,6 +673,7 @@ int tv_list_assign_range(list_T *const dest, list_T *const src, const long idx1_
idx = idx1;
dest_li = first_li;
for (src_li = tv_list_first(src); src_li != NULL;) {
assert(dest_li != NULL);
if (op != NULL && *op != '=') {
eexe_mod_op(TV_LIST_ITEM_TV(dest_li), TV_LIST_ITEM_TV(src_li), op);
} else {
@ -683,7 +684,6 @@ int tv_list_assign_range(list_T *const dest, list_T *const src, const long idx1_
if (src_li == NULL || (!empty_idx2 && idx2 == idx)) {
break;
}
assert(dest_li != NULL);
if (TV_LIST_ITEM_NEXT(dest, dest_li) == NULL) {
// Need to add an empty item.
tv_list_append_number(dest, 0);
@ -1622,7 +1622,7 @@ const char *tv_list_find_str(list_T *const l, const int n)
/// Like tv_list_find() but when a negative index is used that is not found use
/// zero and set "idx" to zero. Used for first index of a range.
listitem_T *tv_list_find_index(list_T *const l, long *const idx)
static listitem_T *tv_list_find_index(list_T *const l, long *const idx)
FUNC_ATTR_WARN_UNUSED_RESULT
{
listitem_T *li = tv_list_find(l, (int)(*idx));

View File

@ -1175,7 +1175,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
// word).
int depth = 0;
trystate_T *sp = &stack[0];
CLEAR_POINTER(sp); // -V1068
CLEAR_POINTER(sp); // -V1086
sp->ts_curi = 1;
if (soundfold) {