refactor: suppress clang and PVS warnings (#19940)

This commit is contained in:
zeertzjq
2022-08-25 15:20:54 +08:00
committed by GitHub
parent 5c9baa6f35
commit f0658fd552
4 changed files with 4 additions and 1 deletions

View File

@@ -8148,6 +8148,7 @@ repeat:
// Only replace it when it starts with '~'
if (*dirname == '~') {
s = xstrdup(dirname);
assert(s != NULL); // suppress clang "Argument with 'nonnull' attribute passed null"
*fnamep = s;
xfree(*bufp);
*bufp = s;

View File

@@ -1252,7 +1252,7 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
idx++;
li = TV_LIST_ITEM_NEXT(l, li);
}
if (info.item_compare_func_err) {
if (info.item_compare_func_err) { // -V547
emsg(_("E882: Uniq compare function failed"));
break;
}

View File

@@ -791,6 +791,7 @@ static void ex_unletlock(exarg_T *eap, char *argstart, int deep, ex_unletlock_ca
semsg(_(e_invarg2), arg - 1);
return;
}
assert(*lv.ll_name == '$'); // suppress clang "Uninitialized argument value"
if (!error && !eap->skip && callback(&lv, arg, eap, deep) == FAIL) {
error = true;
}

View File

@@ -640,6 +640,7 @@ static char_u *ins_compl_infercase_gettext(char_u *str, int char_len, int compl_
while (i < char_len) {
if (gap.ga_data != NULL) {
ga_grow(&gap, 10);
assert(gap.ga_data != NULL); // suppress clang "Dereference of NULL pointer"
p = (char *)gap.ga_data + gap.ga_len;
gap.ga_len += utf_char2bytes(wca[i++], p);
} else if ((p - (char *)IObuff) + 6 >= IOSIZE) {