Skip to content

Commit 6d4b2f5

Browse files
committed
patch 9.0.0263: too many #ifdefs
Problem: Too many #ifdefs. Solution: Make some functions always available.
1 parent 2e6dcbc commit 6d4b2f5

File tree

15 files changed

+27
-117
lines changed

15 files changed

+27
-117
lines changed

src/buffer.c

Lines changed: 14 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,7 @@ open_buffer(
222222

223223
// Read the file if there is one.
224224
if (curbuf->b_ffname != NULL
225-
#ifdef FEAT_QUICKFIX
226225
&& !bt_quickfix(curbuf)
227-
#endif
228226
&& !bt_nofilename(curbuf)
229227
#ifdef FEAT_NETBEANS_INTG
230228
&& netbeansReadFile
@@ -1328,11 +1326,7 @@ do_buffer_ext(
13281326
return FAIL;
13291327
}
13301328
#ifdef FEAT_PROP_POPUP
1331-
if ((flags & DOBUF_NOPOPUP) && bt_popup(buf)
1332-
# ifdef FEAT_TERMINAL
1333-
&& !bt_terminal(buf)
1334-
#endif
1335-
)
1329+
if ((flags & DOBUF_NOPOPUP) && bt_popup(buf) && !bt_terminal(buf))
13361330
return OK;
13371331
#endif
13381332

@@ -1445,11 +1439,7 @@ do_buffer_ext(
14451439
{
14461440
// Skip current and unlisted bufs. Also skip a quickfix
14471441
// buffer, it might be deleted soon.
1448-
if (buf == curbuf || !buf->b_p_bl
1449-
#if defined(FEAT_QUICKFIX)
1450-
|| bt_quickfix(buf)
1451-
#endif
1452-
)
1442+
if (buf == curbuf || !buf->b_p_bl || bt_quickfix(buf))
14531443
buf = NULL;
14541444
else if (buf->b_ml.ml_mfp == NULL)
14551445
{
@@ -1487,10 +1477,7 @@ do_buffer_ext(
14871477
}
14881478
// in non-help buffer, try to skip help buffers, and vv
14891479
if (buf->b_help == curbuf->b_help && buf->b_p_bl
1490-
#if defined(FEAT_QUICKFIX)
1491-
&& !bt_quickfix(buf)
1492-
#endif
1493-
)
1480+
&& !bt_quickfix(buf))
14941481
{
14951482
if (buf->b_ml.ml_mfp != NULL) // found loaded buffer
14961483
break;
@@ -1508,11 +1495,7 @@ do_buffer_ext(
15081495
if (buf == NULL) // No loaded buffer, find listed one
15091496
{
15101497
FOR_ALL_BUFFERS(buf)
1511-
if (buf->b_p_bl && buf != curbuf
1512-
#if defined(FEAT_QUICKFIX)
1513-
&& !bt_quickfix(buf)
1514-
#endif
1515-
)
1498+
if (buf->b_p_bl && buf != curbuf && !bt_quickfix(buf))
15161499
break;
15171500
}
15181501
if (buf == NULL) // Still no buffer, just take one
@@ -1521,10 +1504,8 @@ do_buffer_ext(
15211504
buf = curbuf->b_next;
15221505
else
15231506
buf = curbuf->b_prev;
1524-
#if defined(FEAT_QUICKFIX)
15251507
if (bt_quickfix(buf))
15261508
buf = NULL;
1527-
#endif
15281509
}
15291510
}
15301511

@@ -1987,9 +1968,7 @@ curbuf_reusable(void)
19871968
&& curbuf->b_ffname == NULL
19881969
&& curbuf->b_nwindows <= 1
19891970
&& (curbuf->b_ml.ml_mfp == NULL || BUFEMPTY())
1990-
#if defined(FEAT_QUICKFIX)
19911971
&& !bt_quickfix(curbuf)
1992-
#endif
19931972
&& !curbufIsChanged());
19941973
}
19951974

@@ -3787,15 +3766,9 @@ fileinfo(
37873766
vim_snprintf_add(buffer, IOSIZE, "\"%s%s%s%s%s%s",
37883767
curbufIsChanged() ? (shortmess(SHM_MOD)
37893768
? " [+]" : _(" [Modified]")) : " ",
3790-
(curbuf->b_flags & BF_NOTEDITED)
3791-
#ifdef FEAT_QUICKFIX
3792-
&& !bt_dontwrite(curbuf)
3793-
#endif
3769+
(curbuf->b_flags & BF_NOTEDITED) && !bt_dontwrite(curbuf)
37943770
? _("[Not edited]") : "",
3795-
(curbuf->b_flags & BF_NEW)
3796-
#ifdef FEAT_QUICKFIX
3797-
&& !bt_dontwrite(curbuf)
3798-
#endif
3771+
(curbuf->b_flags & BF_NEW) && !bt_dontwrite(curbuf)
37993772
? new_file_message() : "",
38003773
(curbuf->b_flags & BF_READERR) ? _("[Read errors]") : "",
38013774
curbuf->b_p_ro ? (shortmess(SHM_RO) ? _("[RO]")
@@ -5676,27 +5649,31 @@ bt_normal(buf_T *buf)
56765649
return buf != NULL && buf->b_p_bt[0] == NUL;
56775650
}
56785651

5679-
#if defined(FEAT_QUICKFIX) || defined(PROTO)
56805652
/*
56815653
* Return TRUE if "buf" is the quickfix buffer.
56825654
*/
56835655
int
56845656
bt_quickfix(buf_T *buf)
56855657
{
5658+
#ifdef FEAT_QUICKFIX
56865659
return buf != NULL && buf->b_p_bt[0] == 'q';
5687-
}
5660+
#else
5661+
return FALSE;
56885662
#endif
5663+
}
56895664

5690-
#if defined(FEAT_TERMINAL) || defined(PROTO)
56915665
/*
56925666
* Return TRUE if "buf" is a terminal buffer.
56935667
*/
56945668
int
56955669
bt_terminal(buf_T *buf)
56965670
{
5671+
#if defined(FEAT_TERMINAL)
56975672
return buf != NULL && buf->b_p_bt[0] == 't';
5698-
}
5673+
#else
5674+
return FALSE;
56995675
#endif
5676+
}
57005677

57015678
/*
57025679
* Return TRUE if "buf" is a help buffer.
@@ -5764,7 +5741,6 @@ bt_dontwrite(buf_T *buf)
57645741
|| buf->b_p_bt[0] == 'p');
57655742
}
57665743

5767-
#if defined(FEAT_QUICKFIX) || defined(PROTO)
57685744
int
57695745
bt_dontwrite_msg(buf_T *buf)
57705746
{
@@ -5775,7 +5751,6 @@ bt_dontwrite_msg(buf_T *buf)
57755751
}
57765752
return FALSE;
57775753
}
5778-
#endif
57795754

57805755
/*
57815756
* Return TRUE if the buffer should be hidden, according to 'hidden', ":hide"

src/bufwrite.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -742,9 +742,7 @@ buf_write(
742742
&& reset_changed
743743
&& whole
744744
&& buf == curbuf
745-
#ifdef FEAT_QUICKFIX
746745
&& !bt_nofilename(buf)
747-
#endif
748746
&& !filtering
749747
&& (!append || vim_strchr(p_cpo, CPO_FNAMEAPP) != NULL)
750748
&& vim_strchr(p_cpo, CPO_FNAMEW) != NULL)
@@ -813,11 +811,9 @@ buf_write(
813811
if (!(did_cmd = apply_autocmds_exarg(EVENT_FILEAPPENDCMD,
814812
sfname, sfname, FALSE, curbuf, eap)))
815813
{
816-
#ifdef FEAT_QUICKFIX
817814
if (overwriting && bt_nofilename(curbuf))
818815
nofile_err = TRUE;
819816
else
820-
#endif
821817
apply_autocmds_exarg(EVENT_FILEAPPENDPRE,
822818
sfname, sfname, FALSE, curbuf, eap);
823819
}
@@ -846,11 +842,9 @@ buf_write(
846842
}
847843
else
848844
{
849-
#ifdef FEAT_QUICKFIX
850845
if (overwriting && bt_nofilename(curbuf))
851846
nofile_err = TRUE;
852847
else
853-
#endif
854848
apply_autocmds_exarg(EVENT_BUFWRITEPRE,
855849
sfname, sfname, FALSE, curbuf, eap);
856850
}
@@ -860,11 +854,9 @@ buf_write(
860854
if (!(did_cmd = apply_autocmds_exarg(EVENT_FILEWRITECMD,
861855
sfname, sfname, FALSE, curbuf, eap)))
862856
{
863-
#ifdef FEAT_QUICKFIX
864857
if (overwriting && bt_nofilename(curbuf))
865858
nofile_err = TRUE;
866859
else
867-
#endif
868860
apply_autocmds_exarg(EVENT_FILEWRITEPRE,
869861
sfname, sfname, FALSE, curbuf, eap);
870862
}

src/change.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,7 @@ changed(void)
100100

101101
// Create a swap file if that is wanted.
102102
// Don't do this for "nofile" and "nowrite" buffer types.
103-
if (curbuf->b_may_swap
104-
#ifdef FEAT_QUICKFIX
105-
&& !bt_dontwrite(curbuf)
106-
#endif
107-
)
103+
if (curbuf->b_may_swap && !bt_dontwrite(curbuf))
108104
{
109105
int save_need_wait_return = need_wait_return;
110106

src/drawscreen.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,7 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
482482
len += (int)STRLEN(p + len);
483483
}
484484
#endif
485-
if (bufIsChanged(wp->w_buffer)
486-
#ifdef FEAT_TERMINAL
487-
&& !bt_terminal(wp->w_buffer)
488-
#endif
489-
)
485+
if (bufIsChanged(wp->w_buffer) && !bt_terminal(wp->w_buffer))
490486
{
491487
vim_snprintf((char *)p + len, MAXPATHL - len, "%s", "[+]");
492488
len += (int)STRLEN(p + len);

src/errors.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,9 +954,9 @@ EXTERN char e_at_bottom_of_quickfix_stack[]
954954
INIT(= N_("E380: At bottom of quickfix stack"));
955955
EXTERN char e_at_top_of_quickfix_stack[]
956956
INIT(= N_("E381: At top of quickfix stack"));
957+
#endif
957958
EXTERN char e_cannot_write_buftype_option_is_set[]
958959
INIT(= N_("E382: Cannot write, 'buftype' option is set"));
959-
#endif
960960
EXTERN char e_invalid_search_string_str[]
961961
INIT(= N_("E383: Invalid search string: %s"));
962962
EXTERN char e_search_hit_top_without_match_for_str[]

src/evalbuffer.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,7 @@ find_buffer(typval_T *avar)
9393
// buffer, these don't use the full path.
9494
FOR_ALL_BUFFERS(buf)
9595
if (buf->b_fname != NULL
96-
&& (path_with_url(buf->b_fname)
97-
#ifdef FEAT_QUICKFIX
98-
|| bt_nofilename(buf)
99-
#endif
100-
)
96+
&& (path_with_url(buf->b_fname) || bt_nofilename(buf))
10197
&& STRCMP(buf->b_fname, avar->vval.v_string) == 0)
10298
break;
10399
}

src/ex_cmds.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,12 +1677,7 @@ append_redir(
16771677
(char *)opt, (char *)fname);
16781678
}
16791679
else
1680-
vim_snprintf((char *)end, (size_t)(buflen - (end - buf)),
1681-
#ifdef FEAT_QUICKFIX
1682-
" %s %s",
1683-
#else
1684-
" %s%s", // " > %s" causes problems on Amiga
1685-
#endif
1680+
vim_snprintf((char *)end, (size_t)(buflen - (end - buf)), " %s %s",
16861681
(char *)opt, (char *)fname);
16871682
}
16881683

@@ -1947,11 +1942,7 @@ do_write(exarg_T *eap)
19471942
* and a file name is required.
19481943
* "nofile" and "nowrite" buffers cannot be written implicitly either.
19491944
*/
1950-
if (!other && (
1951-
#ifdef FEAT_QUICKFIX
1952-
bt_dontwrite_msg(curbuf) ||
1953-
#endif
1954-
check_fname() == FAIL
1945+
if (!other && (bt_dontwrite_msg(curbuf) || check_fname() == FAIL
19551946
#ifdef UNIX
19561947
|| check_writable(curbuf->b_ffname) == FAIL
19571948
#endif

src/ex_cmds2.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ autowrite(buf_T *buf, int forceit)
2727
bufref_T bufref;
2828

2929
if (!(p_aw || p_awa) || !p_write
30-
#ifdef FEAT_QUICKFIX
3130
// never autowrite a "nofile" or "nowrite" buffer
3231
|| bt_dontwrite(buf)
33-
#endif
3432
|| (!forceit && buf->b_p_ro) || buf->b_ffname == NULL)
3533
return FAIL;
3634
set_bufref(&bufref, buf);

src/ex_docmd.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ static int getargopt(exarg_T *eap);
5555
# define qf_history ex_ni
5656
# define ex_helpgrep ex_ni
5757
# define ex_vimgrep ex_ni
58-
#endif
59-
#if !defined(FEAT_QUICKFIX)
6058
# define ex_cclose ex_ni
6159
# define ex_copen ex_ni
6260
# define ex_cwindow ex_ni

src/fileio.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,7 @@ readfile(
514514
// Create a swap file now, so that other Vims are warned
515515
// that we are editing this file. Don't do this for a
516516
// "nofile" or "nowrite" buffer type.
517-
#ifdef FEAT_QUICKFIX
518517
if (!bt_dontwrite(curbuf))
519-
#endif
520518
{
521519
check_need_swap(newfile);
522520
// SwapExists autocommand may mess things up
@@ -595,9 +593,7 @@ readfile(
595593
// Create a swap file now, so that other Vims are warned that we are
596594
// editing this file.
597595
// Don't do this for a "nofile" or "nowrite" buffer type.
598-
#ifdef FEAT_QUICKFIX
599596
if (!bt_dontwrite(curbuf))
600-
#endif
601597
{
602598
check_need_swap(newfile);
603599
if (!read_stdin && (curbuf != old_curbuf
@@ -3407,9 +3403,7 @@ shorten_buf_fname(buf_T *buf, char_u *dirname, int force)
34073403
char_u *p;
34083404

34093405
if (buf->b_fname != NULL
3410-
#ifdef FEAT_QUICKFIX
34113406
&& !bt_nofilename(buf)
3412-
#endif
34133407
&& !path_with_url(buf->b_fname)
34143408
&& (force
34153409
|| buf->b_sfname == NULL

0 commit comments

Comments
 (0)