Skip to content

Commit a1f4cb9

Browse files
committed
patch 8.0.0069
Problem: Compiler warning for self-comparison. Solution: Define ONE_WINDOW and add #ifdef.
1 parent 25de4c2 commit a1f4cb9

8 files changed

Lines changed: 21 additions & 14 deletions

File tree

src/buffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4935,7 +4935,7 @@ do_arg_all(
49354935
}
49364936
#ifdef FEAT_WINDOWS
49374937
/* don't close last window */
4938-
if (firstwin == lastwin
4938+
if (ONE_WINDOW
49394939
&& (first_tabpage->tp_next == NULL || !had_tab))
49404940
#endif
49414941
use_firstwin = TRUE;

src/ex_docmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7239,7 +7239,7 @@ ex_quit(exarg_T *eap)
72397239
* :h|wincmd w|1q - don't quit
72407240
* :h|wincmd w|q - quit
72417241
*/
7242-
if (only_one_window() && (firstwin == lastwin || eap->addr_count == 0))
7242+
if (only_one_window() && (ONE_WINDOW || eap->addr_count == 0))
72437243
#endif
72447244
getout(0);
72457245
#ifdef FEAT_WINDOWS

src/globals.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ EXTERN int clip_unnamed_saved INIT(= 0);
546546
EXTERN win_T *firstwin; /* first window */
547547
EXTERN win_T *lastwin; /* last window */
548548
EXTERN win_T *prevwin INIT(= NULL); /* previous window */
549+
# define ONE_WINDOW (firstwin == lastwin)
549550
# define W_NEXT(wp) ((wp)->w_next)
550551
# define FOR_ALL_WINDOWS(wp) for (wp = firstwin; wp != NULL; wp = wp->w_next)
551552
# define FOR_ALL_TABPAGES(tp) for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
@@ -563,6 +564,7 @@ EXTERN win_T *prevwin INIT(= NULL); /* previous window */
563564
#else
564565
# define firstwin curwin
565566
# define lastwin curwin
567+
# define ONE_WINDOW 1
566568
# define W_NEXT(wp) NULL
567569
# define FOR_ALL_WINDOWS(wp) wp = curwin;
568570
# define FOR_ALL_TABPAGES(tp) for (;FALSE;)

src/move.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,7 +2311,7 @@ onepage(int dir, long count)
23112311
#endif
23122312
if (dir == FORWARD)
23132313
{
2314-
if (firstwin == lastwin && p_window > 0 && p_window < Rows - 1)
2314+
if (ONE_WINDOW && p_window > 0 && p_window < Rows - 1)
23152315
{
23162316
/* Vi compatible scrolling */
23172317
if (p_window <= 2)
@@ -2361,7 +2361,7 @@ onepage(int dir, long count)
23612361
continue;
23622362
}
23632363
#endif
2364-
if (firstwin == lastwin && p_window > 0 && p_window < Rows - 1)
2364+
if (ONE_WINDOW && p_window > 0 && p_window < Rows - 1)
23652365
{
23662366
/* Vi compatible scrolling (sort of) */
23672367
if (p_window <= 2)

src/quickfix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2137,7 +2137,7 @@ qf_jump(
21372137
* If there is only one window and it is the quickfix window, create a
21382138
* new one above the quickfix window.
21392139
*/
2140-
if (((firstwin == lastwin) && bt_quickfix(curbuf)) || !usable_win)
2140+
if ((ONE_WINDOW && bt_quickfix(curbuf)) || !usable_win)
21412141
{
21422142
flags = WSP_ABOVE;
21432143
if (ll_ref != NULL)

src/screen.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,7 @@ win_update(win_T *wp)
15101510
if (mid_start == 0)
15111511
{
15121512
mid_end = wp->w_height;
1513-
if (lastwin == firstwin)
1513+
if (ONE_WINDOW)
15141514
{
15151515
/* Clear the screen when it was not done by win_del_lines() or
15161516
* win_ins_lines() above, "screen_cleared" is FALSE or MAYBE
@@ -5670,7 +5670,10 @@ win_line(
56705670
#ifdef FEAT_DIFF
56715671
&& filler_todo <= 0
56725672
#endif
5673-
&& W_WIDTH(wp) == Columns)
5673+
#ifdef FEAT_WINDOWS
5674+
&& W_WIDTH(wp) == Columns
5675+
#endif
5676+
)
56745677
{
56755678
/* Remember that the line wraps, used for modeless copy. */
56765679
LineWraps[screen_row - 1] = TRUE;
@@ -10524,7 +10527,7 @@ fillchar_status(int *attr, int is_curwin)
1052410527
* window differs, or the fillchars differ, or this is not the
1052510528
* current window */
1052610529
if (*attr != 0 && ((hl_attr(HLF_S) != hl_attr(HLF_SNC)
10527-
|| !is_curwin || firstwin == lastwin)
10530+
|| !is_curwin || ONE_WINDOW)
1052810531
|| (fill_stl != fill_stlnc)))
1052910532
return fill;
1053010533
if (is_curwin)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
69,
767769
/**/
768770
68,
769771
/**/

src/window.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ do_window(
234234
/* cursor to previous window with wrap around */
235235
case 'W':
236236
CHECK_CMDWIN
237-
if (firstwin == lastwin && Prenum != 1) /* just one window */
237+
if (ONE_WINDOW && Prenum != 1) /* just one window */
238238
beep_flush();
239239
else
240240
{
@@ -1593,7 +1593,7 @@ win_rotate(int upwards, int count)
15931593
frame_T *frp;
15941594
int n;
15951595

1596-
if (firstwin == lastwin) /* nothing to do */
1596+
if (ONE_WINDOW) /* nothing to do */
15971597
{
15981598
beep_flush();
15991599
return;
@@ -2206,7 +2206,7 @@ one_window(void)
22062206
}
22072207
return TRUE;
22082208
#else
2209-
return firstwin == lastwin;
2209+
return ONE_WINDOW;
22102210
#endif
22112211
}
22122212

@@ -2220,7 +2220,7 @@ close_last_window_tabpage(
22202220
int free_buf,
22212221
tabpage_T *prev_curtab)
22222222
{
2223-
if (firstwin == lastwin)
2223+
if (ONE_WINDOW)
22242224
{
22252225
#ifdef FEAT_AUTOCMD
22262226
buf_T *old_curbuf = curbuf;
@@ -2625,7 +2625,7 @@ winframe_remove(
26252625
/*
26262626
* If there is only one window there is nothing to remove.
26272627
*/
2628-
if (tp == NULL ? firstwin == lastwin : tp->tp_firstwin == tp->tp_lastwin)
2628+
if (tp == NULL ? ONE_WINDOW : tp->tp_firstwin == tp->tp_lastwin)
26292629
return NULL;
26302630

26312631
/*
@@ -2780,7 +2780,7 @@ win_altframe(
27802780
frame_T *frp;
27812781
int b;
27822782

2783-
if (tp == NULL ? firstwin == lastwin : tp->tp_firstwin == tp->tp_lastwin)
2783+
if (tp == NULL ? ONE_WINDOW : tp->tp_firstwin == tp->tp_lastwin)
27842784
/* Last window in this tab page, will go to next tab page. */
27852785
return alt_tabpage()->tp_curwin->w_frame;
27862786

0 commit comments

Comments
 (0)