Review: Remove long_u: memfile: Add to clint.

This commit is contained in:
Eliseo Martínez
2014-10-24 20:52:05 +02:00
parent 09d4133a64
commit 8386255803
3 changed files with 51 additions and 41 deletions

View File

@@ -1,10 +1,10 @@
src/nvim/api/buffer.c
src/nvim/api/buffer.h
src/nvim/api/private/defs.h
src/nvim/api/private/helpers.c
src/nvim/api/private/helpers.h
src/nvim/api/private/handle.c
src/nvim/api/private/handle.h
src/nvim/api/private/helpers.c
src/nvim/api/private/helpers.h
src/nvim/api/tabpage.c
src/nvim/api/tabpage.h
src/nvim/api/vim.c
@@ -22,6 +22,15 @@ src/nvim/log.h
src/nvim/map.c
src/nvim/map.h
src/nvim/map_defs.h
src/nvim/memfile.c
src/nvim/memfile.h
src/nvim/memfile_defs.h
src/nvim/msgpack_rpc/channel.c
src/nvim/msgpack_rpc/channel.h
src/nvim/msgpack_rpc/helpers.c
src/nvim/msgpack_rpc/helpers.h
src/nvim/msgpack_rpc/server.c
src/nvim/msgpack_rpc/server.h
src/nvim/os/env.c
src/nvim/os/event.c
src/nvim/os/event.h
@@ -42,13 +51,7 @@ src/nvim/os/signal.c
src/nvim/os/signal.h
src/nvim/os/time.c
src/nvim/os/time.h
src/nvim/msgpack_rpc/server.c
src/nvim/msgpack_rpc/server.h
src/nvim/msgpack_rpc/channel.c
src/nvim/msgpack_rpc/channel.h
src/nvim/msgpack_rpc/helpers.c
src/nvim/msgpack_rpc/helpers.h
src/nvim/tempfile.c
src/nvim/tempfile.h
src/nvim/profile.c
src/nvim/profile.h
src/nvim/tempfile.c
src/nvim/tempfile.h

View File

@@ -230,11 +230,11 @@ 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;
mf_dont_release = true;
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: should check if all blocks are really in core
(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
@@ -405,9 +405,10 @@ void mf_free(memfile_T *mfp, bhdr_T *hp)
if (hp->bh_bnum < 0) {
free(hp); // don't want negative numbers in free list
mfp->mf_neg_count--;
} else
} else {
mf_ins_free(mfp, hp); // put *hp in the free list
}
}
/// Sync memory file to disk.
///
@@ -433,7 +434,7 @@ int mf_sync(memfile_T *mfp, int flags)
}
// Only a CTRL-C while writing will break us here, not one typed previously.
got_int = FALSE;
got_int = false;
// Sync from last to first (may reduce the probability of an inconsistent
// file). If a write fails, it is very likely caused by a full filesystem.
@@ -456,8 +457,9 @@ int mf_sync(memfile_T *mfp, int flags)
if (flags & MFS_STOP) { // Stop when char available now.
if (ui_char_avail())
break;
} else
} else {
ui_breakcheck();
}
if (got_int)
break;
}
@@ -473,7 +475,7 @@ int mf_sync(memfile_T *mfp, int flags)
if (STRCMP(p_sws, "fsync") == 0) {
if (fsync(mfp->mf_fd))
status = FAIL;
} else
} else {
# endif
// OpenNT is strictly POSIX (Benzinger).
// Tandem/Himalaya NSK-OSS doesn't have sync()
@@ -482,6 +484,9 @@ int mf_sync(memfile_T *mfp, int flags)
# else
sync();
# endif
# ifdef HAVE_FSYNC
}
# endif
#endif
# ifdef SYNC_DUP_CLOSE
// Win32 is a bit more work: Duplicate the file handle and close it.
@@ -656,12 +661,13 @@ bool mf_release_all(void)
mf_free_bhdr(hp);
hp = mfp->mf_used_last; // restart, list was changed
retval = true;
} else
} else {
hp = hp->bh_prev;
}
}
}
}
}
return retval;
}
@@ -762,8 +768,9 @@ static int mf_write(memfile_T *mfp, bhdr_T *hp)
if (nr > mfp->mf_infile_count) { // beyond end of file
nr = mfp->mf_infile_count;
hp2 = mf_find_hash(mfp, nr); // NULL caught below
} else
} else {
hp2 = hp;
}
// TODO(elmart): Check (page_size * nr) within off_t bounds.
offset = (off_t)(page_size * nr);
@@ -783,10 +790,10 @@ static int mf_write(memfile_T *mfp, bhdr_T *hp)
/// space becomes available.
if (!did_swapwrite_msg)
EMSG(_("E297: Write error in swap file"));
did_swapwrite_msg = TRUE;
did_swapwrite_msg = true;
return FAIL;
}
did_swapwrite_msg = FALSE;
did_swapwrite_msg = false;
if (hp2 != NULL) // written a non-dummy block
hp2->bh_flags &= ~BH_DIRTY;
if (nr + (blocknr_T)page_count > mfp->mf_infile_count) // appended to file
@@ -887,7 +894,7 @@ blocknr_T mf_trans_del(memfile_T *mfp, blocknr_T old_nr)
/// name so we must work out the full path name.
void mf_set_ffname(memfile_T *mfp)
{
mfp->mf_ffname = FullName_save(mfp->mf_fname, FALSE);
mfp->mf_ffname = FullName_save(mfp->mf_fname, false);
}
/// Make name of memfile's swapfile a full path.