mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
Remove the mf_dont_release global after getting rid of maxmem[tot]
This commit is contained in:
@@ -588,10 +588,6 @@ EXTERN buf_T *curbuf INIT(= NULL); // currently active buffer
|
||||
#define FOR_ALL_BUFFERS_BACKWARDS(buf) \
|
||||
for (buf_T *buf = lastbuf; buf != NULL; buf = buf->b_prev)
|
||||
|
||||
/* Flag that is set when switching off 'swapfile'. It means that all blocks
|
||||
* are to be loaded into memory. Shouldn't be global... */
|
||||
EXTERN int mf_dont_release INIT(= FALSE); /* don't release blocks */
|
||||
|
||||
/*
|
||||
* List of files being edited (global argument list). curwin->w_alist points
|
||||
* to this when the window is using the global argument list.
|
||||
|
@@ -195,12 +195,9 @@ void mf_close_file(buf_T *buf, bool getlines)
|
||||
|
||||
if (getlines) {
|
||||
// get all blocks in memory by accessing all lines (clumsy!)
|
||||
mf_dont_release = true;
|
||||
for (linenr_T lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum) {
|
||||
for (linenr_T lnum = 1; lnum <= buf->b_ml.ml_line_count; lnum++) {
|
||||
(void)ml_get_buf(buf, lnum, false);
|
||||
}
|
||||
mf_dont_release = false;
|
||||
// TODO(elmart): should check if all blocks are really in core
|
||||
}
|
||||
|
||||
if (close(mfp->mf_fd) < 0) { // close the file
|
||||
|
@@ -1759,7 +1759,7 @@ errorret:
|
||||
* Don't use the last used line when 'swapfile' is reset, need to load all
|
||||
* blocks.
|
||||
*/
|
||||
if (buf->b_ml.ml_line_lnum != lnum || mf_dont_release) {
|
||||
if (buf->b_ml.ml_line_lnum != lnum) {
|
||||
ml_flush_line(buf);
|
||||
|
||||
/*
|
||||
@@ -2760,9 +2760,8 @@ static bhdr_T *ml_find_line(buf_T *buf, linenr_T lnum, int action)
|
||||
if (buf->b_ml.ml_locked) {
|
||||
if (ML_SIMPLE(action)
|
||||
&& buf->b_ml.ml_locked_low <= lnum
|
||||
&& buf->b_ml.ml_locked_high >= lnum
|
||||
&& !mf_dont_release) {
|
||||
/* remember to update pointer blocks and stack later */
|
||||
&& buf->b_ml.ml_locked_high >= lnum) {
|
||||
// remember to update pointer blocks and stack later
|
||||
if (action == ML_INSERT) {
|
||||
++(buf->b_ml.ml_locked_lineadd);
|
||||
++(buf->b_ml.ml_locked_high);
|
||||
|
Reference in New Issue
Block a user