From 2d6c91ab9954c2f3be27c7eefaaa498d91e557be Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 25 Jun 2019 22:38:13 -0400 Subject: vim-patch:8.0.1688: some macros are used without a semicolon Problem: Some macros are used without a semicolon, causing auto-indent to be wrong. Solution: Use the do-while(0) trick. (Ozaki Kiichi, closes vim/vim#2729) https://github.com/vim/vim/commit/6f4700233fd925fe122b851f937929fb5e5da707 --- src/nvim/screen.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/nvim/screen.c') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index d91b832e5a..d141520fef 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1709,7 +1709,6 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T int col; int txtcol; int off; - int ri; /* Build the fold line: * 1. Add the cmdwin_type for the command-line window @@ -1753,15 +1752,18 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T col += fdc; } -# define RL_MEMSET(p, v, l) if (wp->w_p_rl) { \ - for (ri = 0; ri < l; ri++) { \ - linebuf_attr[off + (wp->w_grid.Columns - (p) - (l)) + ri] = v; \ +# define RL_MEMSET(p, v, l) \ + do { \ + if (wp->w_p_rl) { \ + for (int ri = 0; ri < l; ri++) { \ + linebuf_attr[off + (wp->w_grid.Columns - (p) - (l)) + ri] = v; \ + } \ + } else { \ + for (int ri = 0; ri < l; ri++) { \ + linebuf_attr[off + (p) + ri] = v; \ + } \ } \ - } else { \ - for (ri = 0; ri < l; ri++) { \ - linebuf_attr[off + (p) + ri] = v; \ - } \ - } + } while (0) /* Set all attributes of the 'number' or 'relativenumber' column and the * text */ -- cgit