summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-08-01 17:53:12 +0200
committerBram Moolenaar <Bram@vim.org>2018-08-01 17:53:12 +0200
commit91335e5a67aaa9937e65f1e779b9f3f10fd33ee4 (patch)
treeab7a421b7c2dda741870488578e857c237adf517
parentd2855f5454c5c6c5f786b228c5b67757edfefcb1 (diff)
patch 8.1.0230: directly checking 'buftype' valuev8.1.0230
Problem: Directly checking 'buftype' value. Solution: Add the bt_normal() function. (Yegappan Lakshmanan)
-rw-r--r--src/buffer.c9
-rw-r--r--src/ex_docmd.c2
-rw-r--r--src/fileio.c2
-rw-r--r--src/proto/buffer.pro1
-rw-r--r--src/quickfix.c7
-rw-r--r--src/version.c2
6 files changed, 17 insertions, 6 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 1f1833fc74..f76d849a2f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5627,6 +5627,15 @@ write_viminfo_bufferlist(FILE *fp)
#endif
/*
+ * Return TRUE if "buf" is a normal buffer, 'buftype' is empty.
+ */
+ int
+bt_normal(buf_T *buf)
+{
+ return buf != NULL && buf->b_p_bt[0] == NUL;
+}
+
+/*
* Return TRUE if "buf" is the quickfix buffer.
*/
int
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 6682286210..0539a5114b 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -11768,7 +11768,7 @@ put_view(
*/
if ((*flagp & SSOP_FOLDS)
&& wp->w_buffer->b_ffname != NULL
- && (*wp->w_buffer->b_p_bt == NUL || bt_help(wp->w_buffer)))
+ && (bt_normal(wp->w_buffer) || bt_help(wp->w_buffer)))
{
if (put_folds(fd, wp) == FAIL)
return FAIL;
diff --git a/src/fileio.c b/src/fileio.c
index 07b241ece5..281191cfbf 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -6897,7 +6897,7 @@ buf_check_timestamp(
* this buffer. */
if (buf->b_ffname == NULL
|| buf->b_ml.ml_mfp == NULL
- || *buf->b_p_bt != NUL
+ || !bt_normal(buf)
|| buf->b_saving
|| busy
#ifdef FEAT_NETBEANS_INTG
diff --git a/src/proto/buffer.pro b/src/proto/buffer.pro
index 9e63fb6055..6820d9734e 100644
--- a/src/proto/buffer.pro
+++ b/src/proto/buffer.pro
@@ -56,6 +56,7 @@ void ex_buffer_all(exarg_T *eap);
void do_modelines(int flags);
int read_viminfo_bufferlist(vir_T *virp, int writing);
void write_viminfo_bufferlist(FILE *fp);
+int bt_normal(buf_T *buf);
int bt_quickfix(buf_T *buf);
int bt_terminal(buf_T *buf);
int bt_help(buf_T *buf);
diff --git a/src/quickfix.c b/src/quickfix.c
index aac1e3414f..97bfb37cab 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -2487,7 +2487,7 @@ qf_find_win_with_normal_buf(void)
win_T *wp;
FOR_ALL_WINDOWS(wp)
- if (wp->w_buffer->b_p_bt[0] == NUL)
+ if (bt_normal(wp->w_buffer))
return wp;
return NULL;
@@ -2563,7 +2563,7 @@ qf_goto_win_with_ll_file(win_T *use_win, int qf_fnum, qf_info_T *ll_ref)
win = curwin;
do
{
- if (win->w_buffer->b_p_bt[0] == NUL)
+ if (bt_normal(win->w_buffer))
break;
if (win->w_prev == NULL)
win = lastwin; /* wrap around the top */
@@ -2620,8 +2620,7 @@ qf_goto_win_with_qfl_file(int qf_fnum)
}
/* Remember a usable window. */
- if (altwin == NULL && !win->w_p_pvw
- && win->w_buffer->b_p_bt[0] == NUL)
+ if (altwin == NULL && !win->w_p_pvw && bt_normal(win->w_buffer))
altwin = win;
}
diff --git a/src/version.c b/src/version.c
index 5f7d908f1d..e0af0206f0 100644
--- a/src/version.c
+++ b/src/version.c
@@ -795,6 +795,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 230,
+/**/
229,
/**/
228,