fix: clang warnings (#21247)

This commit is contained in:
zeertzjq 2022-12-01 09:05:25 +08:00 committed by GitHub
parent 282dda643a
commit bd2d0edcbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 2 deletions

View File

@ -1427,6 +1427,7 @@ void aucmd_prepbuf(aco_save_T *aco, buf_T *buf)
// then we can't reliably execute the autocmd,
// return with "curbuf" unequal "buf".
if (auc_win == NULL) {
assert(curbuf != buf);
return;
}
}

View File

@ -1946,7 +1946,6 @@ static void calculate_topfill_and_topline(const int fromidx, const int toidx, co
virtual_lines_passed -= from_topfill;
// count the same amount of virtual lines in the toidx buffer
curdif = thistopdiff;
int curlinenum_to = thistopdiff->df_lnum[toidx];
int linesfiller = 0;
count_filler_lines_and_topline(&curlinenum_to, &linesfiller,
@ -2628,7 +2627,7 @@ bool diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp)
break;
}
}
if (dp->is_linematched) {
if (dp != NULL && dp->is_linematched) {
while (dp && dp->df_next
&& lnum == dp->df_count[idx] + dp->df_lnum[idx]
&& dp->df_next->df_lnum[idx] == lnum) {

View File

@ -199,6 +199,7 @@ void tabstop_fromto(colnr_T start_col, colnr_T end_col, long ts_arg, const long
long padding = 0;
int t;
long ts = ts_arg == 0 ? curbuf->b_p_ts : ts_arg;
assert(ts != 0); // suppress clang "Division by zero"
if (vts == NULL || vts[0] == 0) {
int tabs = 0;

View File

@ -2760,6 +2760,7 @@ int win_close(win_T *win, bool free_buf, bool force)
if (win->w_floating) {
ui_comp_remove_grid(&win->w_grid_alloc);
assert(first_tabpage != NULL); // suppress clang "Dereference of NULL pointer"
if (win->w_float_config.external) {
for (tabpage_T *tp = first_tabpage; tp != NULL; tp = tp->tp_next) {
if (tp == curtab) {