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.c
src/nvim/api/buffer.h src/nvim/api/buffer.h
src/nvim/api/private/defs.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.c
src/nvim/api/private/handle.h 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.c
src/nvim/api/tabpage.h src/nvim/api/tabpage.h
src/nvim/api/vim.c src/nvim/api/vim.c
@@ -22,6 +22,15 @@ src/nvim/log.h
src/nvim/map.c src/nvim/map.c
src/nvim/map.h src/nvim/map.h
src/nvim/map_defs.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/env.c
src/nvim/os/event.c src/nvim/os/event.c
src/nvim/os/event.h src/nvim/os/event.h
@@ -42,13 +51,7 @@ src/nvim/os/signal.c
src/nvim/os/signal.h src/nvim/os/signal.h
src/nvim/os/time.c src/nvim/os/time.c
src/nvim/os/time.h 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.c
src/nvim/profile.h 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) { if (getlines) {
// get all blocks in memory by accessing all lines (clumsy!) // 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) for (linenr_T lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum)
(void)ml_get_buf(buf, lnum, FALSE); (void)ml_get_buf(buf, lnum, false);
mf_dont_release = FALSE; mf_dont_release = false;
// TODO: should check if all blocks are really in core // TODO(elmart): should check if all blocks are really in core
} }
if (close(mfp->mf_fd) < 0) // close the file 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) { if (hp->bh_bnum < 0) {
free(hp); // don't want negative numbers in free list free(hp); // don't want negative numbers in free list
mfp->mf_neg_count--; mfp->mf_neg_count--;
} else } else {
mf_ins_free(mfp, hp); // put *hp in the free list mf_ins_free(mfp, hp); // put *hp in the free list
} }
}
/// Sync memory file to disk. /// 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. // 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 // 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. // 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 (flags & MFS_STOP) { // Stop when char available now.
if (ui_char_avail()) if (ui_char_avail())
break; break;
} else } else {
ui_breakcheck(); ui_breakcheck();
}
if (got_int) if (got_int)
break; break;
} }
@@ -473,7 +475,7 @@ int mf_sync(memfile_T *mfp, int flags)
if (STRCMP(p_sws, "fsync") == 0) { if (STRCMP(p_sws, "fsync") == 0) {
if (fsync(mfp->mf_fd)) if (fsync(mfp->mf_fd))
status = FAIL; status = FAIL;
} else } else {
# endif # endif
// OpenNT is strictly POSIX (Benzinger). // OpenNT is strictly POSIX (Benzinger).
// Tandem/Himalaya NSK-OSS doesn't have sync() // Tandem/Himalaya NSK-OSS doesn't have sync()
@@ -482,6 +484,9 @@ int mf_sync(memfile_T *mfp, int flags)
# else # else
sync(); sync();
# endif # endif
# ifdef HAVE_FSYNC
}
# endif
#endif #endif
# ifdef SYNC_DUP_CLOSE # ifdef SYNC_DUP_CLOSE
// Win32 is a bit more work: Duplicate the file handle and close it. // 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); mf_free_bhdr(hp);
hp = mfp->mf_used_last; // restart, list was changed hp = mfp->mf_used_last; // restart, list was changed
retval = true; retval = true;
} else } else {
hp = hp->bh_prev; hp = hp->bh_prev;
} }
} }
} }
} }
}
return retval; 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 if (nr > mfp->mf_infile_count) { // beyond end of file
nr = mfp->mf_infile_count; nr = mfp->mf_infile_count;
hp2 = mf_find_hash(mfp, nr); // NULL caught below hp2 = mf_find_hash(mfp, nr); // NULL caught below
} else } else {
hp2 = hp; hp2 = hp;
}
// TODO(elmart): Check (page_size * nr) within off_t bounds. // TODO(elmart): Check (page_size * nr) within off_t bounds.
offset = (off_t)(page_size * nr); offset = (off_t)(page_size * nr);
@@ -783,10 +790,10 @@ static int mf_write(memfile_T *mfp, bhdr_T *hp)
/// space becomes available. /// space becomes available.
if (!did_swapwrite_msg) if (!did_swapwrite_msg)
EMSG(_("E297: Write error in swap file")); EMSG(_("E297: Write error in swap file"));
did_swapwrite_msg = TRUE; did_swapwrite_msg = true;
return FAIL; return FAIL;
} }
did_swapwrite_msg = FALSE; did_swapwrite_msg = false;
if (hp2 != NULL) // written a non-dummy block if (hp2 != NULL) // written a non-dummy block
hp2->bh_flags &= ~BH_DIRTY; hp2->bh_flags &= ~BH_DIRTY;
if (nr + (blocknr_T)page_count > mfp->mf_infile_count) // appended to file 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. /// name so we must work out the full path name.
void mf_set_ffname(memfile_T *mfp) 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. /// Make name of memfile's swapfile a full path.