]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.0263: too many #ifdefs v9.0.0263
authorBram Moolenaar <Bram@vim.org>
Thu, 25 Aug 2022 14:11:15 +0000 (15:11 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 25 Aug 2022 14:11:15 +0000 (15:11 +0100)
Problem:    Too many #ifdefs.
Solution:   Make some functions always available.

15 files changed:
src/buffer.c
src/bufwrite.c
src/change.c
src/drawscreen.c
src/errors.h
src/evalbuffer.c
src/ex_cmds.c
src/ex_cmds2.c
src/ex_docmd.c
src/fileio.c
src/netbeans.c
src/session.c
src/version.c
src/viminfo.c
src/window.c

index f2f32e1a6247c8bfd64170c6c271c4138c1489dd..ebba88b371479298d146cbc4104960fd9e1a8557 100644 (file)
@@ -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"
index d7c3034766b6a11186d2480cab44d545a39325eb..5db8f2983b36ecd3dbf11fbde8cceea6b70cf002 100644 (file)
@@ -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);
            }
index 51ffe28524ce21ed5b0fa2451f73ed21c6fd306f..71ad9eaf87ef6ebf44294fa5ce5291601fbaafb8 100644 (file)
@@ -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;
 
index a9b3643ed8092745d5e155f9468ba9d7474accd5..ff0f2eaebd695abc11dd0bb7d008c84d7b557a77 100644 (file)
@@ -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);
index 940d05594020d43f4736178f33f8f244d7293bff..edd25ce03c6795192459805535f942243ebdd668 100644 (file)
@@ -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[]
index fe41f08487e541ada6f4cf06930b6878badaad85..15ac58021af01f0c374403ba2916f4f9aab18202 100644 (file)
@@ -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;
        }
index 87a7b50e064512d03a4ff791fe60e1154bff0c39..01518ff64deca6d25f6029ea4db00b84d6d758e9 100644 (file)
@@ -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
index 2de1798b18675d476a4fd160f8d51b9e49890f1c..a41e0675b7d2ad7182e1f8c56550ded292fc82b9 100644 (file)
@@ -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);
index 382029a65a8652636f30e9a1fccd485609f9ca87..b9ff423b64061de304deed957658e441047383e0 100644 (file)
@@ -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
index 7750c525b7718ed905a54bc99b48ea42f2f0a8ec..6d063a5ab754eda1a106dd554939b34f8853507b 100644 (file)
@@ -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
index f9ef19a140c7e2134201f3caabb587219e7538ac..523cda08d781c976e4042e41aa9d2e7074ea5d59 100644 (file)
@@ -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;
 
index fb9d1404ad24c3a070580044a6bc47c3a153ccf9..ddf5d21d117ab8b5c848a8db5bd94882fa4c8a2b 100644 (file)
@@ -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;
index 8ca27a523bad4680de7fd5a619b86cbeca9c26cf..ce61bbc3d00cbc39219cc8081c2b8357dc03c9fc 100644 (file)
@@ -731,6 +731,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    263,
 /**/
     262,
 /**/
index cc28a12097be01ba7b70574fe11e463491c50fdc..cd734130f6c664a02e91bb1ea968cc8363aa0e83 100644 (file)
@@ -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);
 }
 
 /*
index f52aa64f8ab3b92bacfc0dac8e7bfb9aaded2b19..3ee65fbf4ab3f319ecd9c7d7bbbe986f141e208f 100644 (file)
@@ -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);