diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-07-10 18:21:50 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-07-10 18:21:50 +0200 |
commit | b25f9a97e9aad3cbb4bc3fe87cdbd5700f8aa0c6 (patch) | |
tree | c51d62bd77521a1de07d989af9a8ca3cd8c8b85a /src/structs.h | |
parent | 8240433f48f7383c281ba2453cc55f10b8ec47d9 (diff) | |
download | vim-git-b25f9a97e9aad3cbb4bc3fe87cdbd5700f8aa0c6.tar.gz |
patch 7.4.2018v7.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.
Diffstat (limited to 'src/structs.h')
-rw-r--r-- | src/structs.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/structs.h b/src/structs.h index 05f461705..e092e6b2d 100644 --- a/src/structs.h +++ b/src/structs.h @@ -69,6 +69,14 @@ typedef struct frame_S frame_T; typedef int scid_T; /* script ID */ 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; + /* * This is here because regexp.h needs pos_T and below regprog_T is used. */ |