aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-12-01 09:05:25 +0800
committerGitHub <noreply@github.com>2022-12-01 09:05:25 +0800
commitbd2d0edcbf4e98e05edff13f344865fcafac56b5 (patch)
tree13253884d9c197f8355227b8e248d5d3750bd73d
parent282dda643ae598d5c8e9f34c379d931563b4891b (diff)
downloadrneovim-bd2d0edcbf4e98e05edff13f344865fcafac56b5.tar.gz
rneovim-bd2d0edcbf4e98e05edff13f344865fcafac56b5.tar.bz2
rneovim-bd2d0edcbf4e98e05edff13f344865fcafac56b5.zip
fix: clang warnings (#21247)
-rw-r--r--src/nvim/autocmd.c1
-rw-r--r--src/nvim/diff.c3
-rw-r--r--src/nvim/indent.c1
-rw-r--r--src/nvim/window.c1
4 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 6efb05ab45..57d829d186 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -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;
}
}
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 64a142fa0e..ac637c2c70 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -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) {
diff --git a/src/nvim/indent.c b/src/nvim/indent.c
index bd91d1d4da..2777ebd18c 100644
--- a/src/nvim/indent.c
+++ b/src/nvim/indent.c
@@ -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;
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 2927855073..e761f7e40b 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -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) {