aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer_defs.h
diff options
context:
space:
mode:
authorMarco Hinz <mh.codebro@gmail.com>2017-01-09 02:03:03 +0100
committerJames McCoy <jamessan@jamessan.com>2017-02-04 17:55:29 -0500
commite177226d51feb99e159773eebe6a773732fc89e9 (patch)
treedece7dd4cbc637b940393e19d5e117b323594a5c /src/nvim/buffer_defs.h
parent951dd1571cbb57b41274c0e515e2b3c789305bad (diff)
downloadrneovim-e177226d51feb99e159773eebe6a773732fc89e9.tar.gz
rneovim-e177226d51feb99e159773eebe6a773732fc89e9.tar.bz2
rneovim-e177226d51feb99e159773eebe6a773732fc89e9.zip
vim-patch:7.4.2018
Problem: buf_valid() can be slow when there are many buffers. Solution: Add bufref_valid(), only go through the buffer list when a buffer was freed. https://github.com/vim/vim/commit/b25f9a97e9aad3cbb4bc3fe87cdbd5700f8aa0c6
Diffstat (limited to 'src/nvim/buffer_defs.h')
-rw-r--r--src/nvim/buffer_defs.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index 29f4dfe4fb..73d06de964 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -8,6 +8,13 @@
typedef struct file_buffer buf_T; // Forward declaration
+// Reference to a buffer that stores the value of buf_free_count.
+// bufref_valid() only needs to check "buf" when the count differs.
+typedef struct {
+ buf_T *br_buf;
+ int br_buf_free_count;
+} bufref_T;
+
// for garray_T
#include "nvim/garray.h"
// for pos_T, lpos_T and linenr_T