Remove the mf_dont_release global after getting rid of maxmem[tot]

This commit is contained in:
Felipe Oliveira Carvalho
2016-03-29 01:56:21 -03:00
parent 9ea111d1af
commit d0b08f32f5
3 changed files with 4 additions and 12 deletions

View File

@@ -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.

View File

@@ -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

View 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);