diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-08-25 15:11:15 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-08-25 15:11:15 +0100 |
commit | 6d4b2f54df5d533eb0794331f38445a6ca5d3a3f (patch) | |
tree | 0a6011c47bb9cf12806cb0484016ce6f071fc361 | |
parent | 2e6dcbc4450c98bd12faace5d77a65f2afddae44 (diff) | |
download | vim-git-6d4b2f54df5d533eb0794331f38445a6ca5d3a3f.tar.gz |
patch 9.0.0263: too many #ifdefsv9.0.0263
Problem: Too many #ifdefs.
Solution: Make some functions always available.
-rw-r--r-- | src/buffer.c | 53 | ||||
-rw-r--r-- | src/bufwrite.c | 8 | ||||
-rw-r--r-- | src/change.c | 6 | ||||
-rw-r--r-- | src/drawscreen.c | 6 | ||||
-rw-r--r-- | src/errors.h | 2 | ||||
-rw-r--r-- | src/evalbuffer.c | 6 | ||||
-rw-r--r-- | src/ex_cmds.c | 13 | ||||
-rw-r--r-- | src/ex_cmds2.c | 2 | ||||
-rw-r--r-- | src/ex_docmd.c | 2 | ||||
-rw-r--r-- | src/fileio.c | 6 | ||||
-rw-r--r-- | src/netbeans.c | 5 | ||||
-rw-r--r-- | src/session.c | 17 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/viminfo.c | 10 | ||||
-rw-r--r-- | src/window.c | 6 |
15 files changed, 27 insertions, 117 deletions
diff --git a/src/buffer.c b/src/buffer.c index f2f32e1a6..ebba88b37 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -222,9 +222,7 @@ open_buffer( // Read the file if there is one. if (curbuf->b_ffname != NULL -#ifdef FEAT_QUICKFIX && !bt_quickfix(curbuf) -#endif && !bt_nofilename(curbuf) #ifdef FEAT_NETBEANS_INTG && netbeansReadFile @@ -1328,11 +1326,7 @@ do_buffer_ext( return FAIL; } #ifdef FEAT_PROP_POPUP - if ((flags & DOBUF_NOPOPUP) && bt_popup(buf) -# ifdef FEAT_TERMINAL - && !bt_terminal(buf) -#endif - ) + if ((flags & DOBUF_NOPOPUP) && bt_popup(buf) && !bt_terminal(buf)) return OK; #endif @@ -1445,11 +1439,7 @@ do_buffer_ext( { // Skip current and unlisted bufs. Also skip a quickfix // buffer, it might be deleted soon. - if (buf == curbuf || !buf->b_p_bl -#if defined(FEAT_QUICKFIX) - || bt_quickfix(buf) -#endif - ) + if (buf == curbuf || !buf->b_p_bl || bt_quickfix(buf)) buf = NULL; else if (buf->b_ml.ml_mfp == NULL) { @@ -1487,10 +1477,7 @@ do_buffer_ext( } // in non-help buffer, try to skip help buffers, and vv if (buf->b_help == curbuf->b_help && buf->b_p_bl -#if defined(FEAT_QUICKFIX) - && !bt_quickfix(buf) -#endif - ) + && !bt_quickfix(buf)) { if (buf->b_ml.ml_mfp != NULL) // found loaded buffer break; @@ -1508,11 +1495,7 @@ do_buffer_ext( if (buf == NULL) // No loaded buffer, find listed one { FOR_ALL_BUFFERS(buf) - if (buf->b_p_bl && buf != curbuf -#if defined(FEAT_QUICKFIX) - && !bt_quickfix(buf) -#endif - ) + if (buf->b_p_bl && buf != curbuf && !bt_quickfix(buf)) break; } if (buf == NULL) // Still no buffer, just take one @@ -1521,10 +1504,8 @@ do_buffer_ext( buf = curbuf->b_next; else buf = curbuf->b_prev; -#if defined(FEAT_QUICKFIX) if (bt_quickfix(buf)) buf = NULL; -#endif } } @@ -1987,9 +1968,7 @@ curbuf_reusable(void) && curbuf->b_ffname == NULL && curbuf->b_nwindows <= 1 && (curbuf->b_ml.ml_mfp == NULL || BUFEMPTY()) -#if defined(FEAT_QUICKFIX) && !bt_quickfix(curbuf) -#endif && !curbufIsChanged()); } @@ -3787,15 +3766,9 @@ fileinfo( vim_snprintf_add(buffer, IOSIZE, "\"%s%s%s%s%s%s", curbufIsChanged() ? (shortmess(SHM_MOD) ? " [+]" : _(" [Modified]")) : " ", - (curbuf->b_flags & BF_NOTEDITED) -#ifdef FEAT_QUICKFIX - && !bt_dontwrite(curbuf) -#endif + (curbuf->b_flags & BF_NOTEDITED) && !bt_dontwrite(curbuf) ? _("[Not edited]") : "", - (curbuf->b_flags & BF_NEW) -#ifdef FEAT_QUICKFIX - && !bt_dontwrite(curbuf) -#endif + (curbuf->b_flags & BF_NEW) && !bt_dontwrite(curbuf) ? new_file_message() : "", (curbuf->b_flags & BF_READERR) ? _("[Read errors]") : "", curbuf->b_p_ro ? (shortmess(SHM_RO) ? _("[RO]") @@ -5676,27 +5649,31 @@ bt_normal(buf_T *buf) return buf != NULL && buf->b_p_bt[0] == NUL; } -#if defined(FEAT_QUICKFIX) || defined(PROTO) /* * Return TRUE if "buf" is the quickfix buffer. */ int bt_quickfix(buf_T *buf) { +#ifdef FEAT_QUICKFIX return buf != NULL && buf->b_p_bt[0] == 'q'; -} +#else + return FALSE; #endif +} -#if defined(FEAT_TERMINAL) || defined(PROTO) /* * Return TRUE if "buf" is a terminal buffer. */ int bt_terminal(buf_T *buf) { +#if defined(FEAT_TERMINAL) return buf != NULL && buf->b_p_bt[0] == 't'; -} +#else + return FALSE; #endif +} /* * Return TRUE if "buf" is a help buffer. @@ -5764,7 +5741,6 @@ bt_dontwrite(buf_T *buf) || buf->b_p_bt[0] == 'p'); } -#if defined(FEAT_QUICKFIX) || defined(PROTO) int bt_dontwrite_msg(buf_T *buf) { @@ -5775,7 +5751,6 @@ bt_dontwrite_msg(buf_T *buf) } return FALSE; } -#endif /* * Return TRUE if the buffer should be hidden, according to 'hidden', ":hide" diff --git a/src/bufwrite.c b/src/bufwrite.c index d7c303476..5db8f2983 100644 --- a/src/bufwrite.c +++ b/src/bufwrite.c @@ -742,9 +742,7 @@ buf_write( && reset_changed && whole && buf == curbuf -#ifdef FEAT_QUICKFIX && !bt_nofilename(buf) -#endif && !filtering && (!append || vim_strchr(p_cpo, CPO_FNAMEAPP) != NULL) && vim_strchr(p_cpo, CPO_FNAMEW) != NULL) @@ -813,11 +811,9 @@ buf_write( if (!(did_cmd = apply_autocmds_exarg(EVENT_FILEAPPENDCMD, sfname, sfname, FALSE, curbuf, eap))) { -#ifdef FEAT_QUICKFIX if (overwriting && bt_nofilename(curbuf)) nofile_err = TRUE; else -#endif apply_autocmds_exarg(EVENT_FILEAPPENDPRE, sfname, sfname, FALSE, curbuf, eap); } @@ -846,11 +842,9 @@ buf_write( } else { -#ifdef FEAT_QUICKFIX if (overwriting && bt_nofilename(curbuf)) nofile_err = TRUE; else -#endif apply_autocmds_exarg(EVENT_BUFWRITEPRE, sfname, sfname, FALSE, curbuf, eap); } @@ -860,11 +854,9 @@ buf_write( if (!(did_cmd = apply_autocmds_exarg(EVENT_FILEWRITECMD, sfname, sfname, FALSE, curbuf, eap))) { -#ifdef FEAT_QUICKFIX if (overwriting && bt_nofilename(curbuf)) nofile_err = TRUE; else -#endif apply_autocmds_exarg(EVENT_FILEWRITEPRE, sfname, sfname, FALSE, curbuf, eap); } diff --git a/src/change.c b/src/change.c index 51ffe2852..71ad9eaf8 100644 --- a/src/change.c +++ b/src/change.c @@ -100,11 +100,7 @@ changed(void) // Create a swap file if that is wanted. // Don't do this for "nofile" and "nowrite" buffer types. - if (curbuf->b_may_swap -#ifdef FEAT_QUICKFIX - && !bt_dontwrite(curbuf) -#endif - ) + if (curbuf->b_may_swap && !bt_dontwrite(curbuf)) { int save_need_wait_return = need_wait_return; diff --git a/src/drawscreen.c b/src/drawscreen.c index a9b3643ed..ff0f2eaeb 100644 --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -482,11 +482,7 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED) len += (int)STRLEN(p + len); } #endif - if (bufIsChanged(wp->w_buffer) -#ifdef FEAT_TERMINAL - && !bt_terminal(wp->w_buffer) -#endif - ) + if (bufIsChanged(wp->w_buffer) && !bt_terminal(wp->w_buffer)) { vim_snprintf((char *)p + len, MAXPATHL - len, "%s", "[+]"); len += (int)STRLEN(p + len); diff --git a/src/errors.h b/src/errors.h index 940d05594..edd25ce03 100644 --- a/src/errors.h +++ b/src/errors.h @@ -954,9 +954,9 @@ EXTERN char e_at_bottom_of_quickfix_stack[] INIT(= N_("E380: At bottom of quickfix stack")); EXTERN char e_at_top_of_quickfix_stack[] INIT(= N_("E381: At top of quickfix stack")); +#endif EXTERN char e_cannot_write_buftype_option_is_set[] INIT(= N_("E382: Cannot write, 'buftype' option is set")); -#endif EXTERN char e_invalid_search_string_str[] INIT(= N_("E383: Invalid search string: %s")); EXTERN char e_search_hit_top_without_match_for_str[] diff --git a/src/evalbuffer.c b/src/evalbuffer.c index fe41f0848..15ac58021 100644 --- a/src/evalbuffer.c +++ b/src/evalbuffer.c @@ -93,11 +93,7 @@ find_buffer(typval_T *avar) // buffer, these don't use the full path. FOR_ALL_BUFFERS(buf) if (buf->b_fname != NULL - && (path_with_url(buf->b_fname) -#ifdef FEAT_QUICKFIX - || bt_nofilename(buf) -#endif - ) + && (path_with_url(buf->b_fname) || bt_nofilename(buf)) && STRCMP(buf->b_fname, avar->vval.v_string) == 0) break; } diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 87a7b50e0..01518ff64 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -1677,12 +1677,7 @@ append_redir( (char *)opt, (char *)fname); } else - vim_snprintf((char *)end, (size_t)(buflen - (end - buf)), -#ifdef FEAT_QUICKFIX - " %s %s", -#else - " %s%s", // " > %s" causes problems on Amiga -#endif + vim_snprintf((char *)end, (size_t)(buflen - (end - buf)), " %s %s", (char *)opt, (char *)fname); } @@ -1947,11 +1942,7 @@ do_write(exarg_T *eap) * and a file name is required. * "nofile" and "nowrite" buffers cannot be written implicitly either. */ - if (!other && ( -#ifdef FEAT_QUICKFIX - bt_dontwrite_msg(curbuf) || -#endif - check_fname() == FAIL + if (!other && (bt_dontwrite_msg(curbuf) || check_fname() == FAIL #ifdef UNIX || check_writable(curbuf->b_ffname) == FAIL #endif diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 2de1798b1..a41e0675b 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -27,10 +27,8 @@ autowrite(buf_T *buf, int forceit) bufref_T bufref; if (!(p_aw || p_awa) || !p_write -#ifdef FEAT_QUICKFIX // never autowrite a "nofile" or "nowrite" buffer || bt_dontwrite(buf) -#endif || (!forceit && buf->b_p_ro) || buf->b_ffname == NULL) return FAIL; set_bufref(&bufref, buf); diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 382029a65..b9ff423b6 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -55,8 +55,6 @@ static int getargopt(exarg_T *eap); # define qf_history ex_ni # define ex_helpgrep ex_ni # define ex_vimgrep ex_ni -#endif -#if !defined(FEAT_QUICKFIX) # define ex_cclose ex_ni # define ex_copen ex_ni # define ex_cwindow ex_ni diff --git a/src/fileio.c b/src/fileio.c index 7750c525b..6d063a5ab 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -514,9 +514,7 @@ readfile( // Create a swap file now, so that other Vims are warned // that we are editing this file. Don't do this for a // "nofile" or "nowrite" buffer type. -#ifdef FEAT_QUICKFIX if (!bt_dontwrite(curbuf)) -#endif { check_need_swap(newfile); // SwapExists autocommand may mess things up @@ -595,9 +593,7 @@ readfile( // Create a swap file now, so that other Vims are warned that we are // editing this file. // Don't do this for a "nofile" or "nowrite" buffer type. -#ifdef FEAT_QUICKFIX if (!bt_dontwrite(curbuf)) -#endif { check_need_swap(newfile); if (!read_stdin && (curbuf != old_curbuf @@ -3407,9 +3403,7 @@ shorten_buf_fname(buf_T *buf, char_u *dirname, int force) char_u *p; if (buf->b_fname != NULL -#ifdef FEAT_QUICKFIX && !bt_nofilename(buf) -#endif && !path_with_url(buf->b_fname) && (force || buf->b_sfname == NULL diff --git a/src/netbeans.c b/src/netbeans.c index f9ef19a14..523cda08d 100644 --- a/src/netbeans.c +++ b/src/netbeans.c @@ -2152,10 +2152,7 @@ nb_do_cmd( if (p_write && !buf->bufp->b_p_ro && buf->bufp->b_ffname != NULL -#ifdef FEAT_QUICKFIX - && !bt_dontwrite(buf->bufp) -#endif - ) + && !bt_dontwrite(buf->bufp)) { bufref_T bufref; diff --git a/src/session.c b/src/session.c index fb9d1404a..ddf5d21d1 100644 --- a/src/session.c +++ b/src/session.c @@ -148,11 +148,8 @@ ses_do_win(win_T *wp) && term_should_restore(wp->w_buffer); #endif if (wp->w_buffer->b_fname == NULL -#ifdef FEAT_QUICKFIX // When 'buftype' is "nofile" can't restore the window contents. - || bt_nofilename(wp->w_buffer) -#endif - ) + || bt_nofilename(wp->w_buffer)) return (ssop_flags & SSOP_BLANK); if (bt_help(wp->w_buffer)) return (ssop_flags & SSOP_HELP); @@ -374,10 +371,7 @@ put_view( # endif // Load the file. else if (wp->w_buffer->b_ffname != NULL -# ifdef FEAT_QUICKFIX - && !bt_nofilename(wp->w_buffer) -# endif - ) + && !bt_nofilename(wp->w_buffer)) { // Editing a file in this buffer: use ":edit file". // This may have side effects! (e.g., compressed or network file). @@ -708,11 +702,9 @@ makeopens( { if (!(only_save_windows && buf->b_nwindows == 0) && !(buf->b_help && !(ssop_flags & SSOP_HELP)) -#ifdef FEAT_TERMINAL // Skip terminal buffers: finished ones are not useful, others // will be resurrected and result in a new buffer. && !bt_terminal(buf) -#endif && buf->b_fname != NULL && buf->b_p_bl) { @@ -818,10 +810,7 @@ makeopens( if (ses_do_win(wp) && wp->w_buffer->b_ffname != NULL && !bt_help(wp->w_buffer) -#ifdef FEAT_QUICKFIX - && !bt_nofilename(wp->w_buffer) -#endif - ) + && !bt_nofilename(wp->w_buffer)) { if (need_tabnext && put_line(fd, "tabnext") == FAIL) goto fail; diff --git a/src/version.c b/src/version.c index 8ca27a523..ce61bbc3d 100644 --- a/src/version.c +++ b/src/version.c @@ -732,6 +732,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 263, +/**/ 262, /**/ 261, diff --git a/src/viminfo.c b/src/viminfo.c index cc28a1209..cd734130f 100644 --- a/src/viminfo.c +++ b/src/viminfo.c @@ -434,12 +434,8 @@ write_viminfo_bufferlist(FILE *fp) { if (buf->b_fname == NULL || !buf->b_p_bl -#ifdef FEAT_QUICKFIX || bt_quickfix(buf) -#endif -#ifdef FEAT_TERMINAL || bt_terminal(buf) -#endif || removable(buf->b_ffname)) continue; @@ -1994,11 +1990,7 @@ write_buffer_marks(buf_T *buf, FILE *fp_out) static int skip_for_viminfo(buf_T *buf) { - return -#ifdef FEAT_TERMINAL - bt_terminal(buf) || -#endif - removable(buf->b_ffname); + return bt_terminal(buf) || removable(buf->b_ffname); } /* diff --git a/src/window.c b/src/window.c index f52aa64f8..3ee65fbf4 100644 --- a/src/window.c +++ b/src/window.c @@ -172,12 +172,10 @@ do_window( case 's': CHECK_CMDWIN; reset_VIsual_and_resel(); // stop Visual mode -#ifdef FEAT_QUICKFIX // When splitting the quickfix window open a new buffer in it, // don't replicate the quickfix buffer. if (bt_quickfix(curbuf)) goto newwindow; -#endif #ifdef FEAT_GUI need_mouse_correct = TRUE; #endif @@ -189,12 +187,10 @@ do_window( case 'v': CHECK_CMDWIN; reset_VIsual_and_resel(); // stop Visual mode -#ifdef FEAT_QUICKFIX // When splitting the quickfix window open a new buffer in it, // don't replicate the quickfix buffer. if (bt_quickfix(curbuf)) goto newwindow; -#endif #ifdef FEAT_GUI need_mouse_correct = TRUE; #endif @@ -228,9 +224,7 @@ do_window( case 'n': CHECK_CMDWIN; reset_VIsual_and_resel(); // stop Visual mode -#ifdef FEAT_QUICKFIX newwindow: -#endif if (Prenum) // window height vim_snprintf((char *)cbuf, sizeof(cbuf) - 5, "%ld", Prenum); |