aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/memline.c
diff options
context:
space:
mode:
authorFlorian Walch <florian@fwalch.com>2015-01-10 20:52:48 +0100
committerFlorian Walch <florian@fwalch.com>2015-04-08 18:33:54 +0300
commitdea2731184f23521f5eae03ab46cbe811b8825b7 (patch)
treec5e8bd2fc9e1ee9a98620eafe45675c4b15a87c2 /src/nvim/memline.c
parent95db8df682ea7ac392a1e9a6de45a6ccc0727df1 (diff)
downloadrneovim-dea2731184f23521f5eae03ab46cbe811b8825b7.tar.gz
rneovim-dea2731184f23521f5eae03ab46cbe811b8825b7.tar.bz2
rneovim-dea2731184f23521f5eae03ab46cbe811b8825b7.zip
vim-patch: Port parts of Vim 7.4.399.
Resolves #1753. https://code.google.com/p/vim/source/detail?r=v7-4-399 Reviewed-by: Felipe Oliveira Carvalho <felipekde@gmail.com> Helped-by: David Bürgin <676c7473@gmail.com> Helped-by: Scott Prager <splinterofchaos@gmail.com> Helped-by: Michael Reed <m.reed@mykolab.com> Helped-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
Diffstat (limited to 'src/nvim/memline.c')
-rw-r--r--src/nvim/memline.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 8b2ebfe554..93fbbd512f 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -91,8 +91,6 @@ typedef struct pointer_entry PTR_EN; /* block/line-count pair */
#define PTR_ID (('p' << 8) + 't') /* pointer block id */
#define BLOCK0_ID0 'b' /* block 0 id 0 */
#define BLOCK0_ID1 '0' /* block 0 id 1 */
-#define BLOCK0_ID1_C0 'c' /* block 0 id 1 'cm' 0 */
-#define BLOCK0_ID1_C1 'C' /* block 0 id 1 'cm' 1 */
/*
* pointer to a block, used in a pointer block
@@ -176,8 +174,7 @@ struct data_block {
* variables, because the rest of the swap file is not portable.
*/
struct block0 {
- char_u b0_id[2]; /* id for block 0: BLOCK0_ID0 and BLOCK0_ID1,
- * BLOCK0_ID1_C0, BLOCK0_ID1_C1 */
+ char_u b0_id[2]; ///< ID for block 0: BLOCK0_ID0 and BLOCK0_ID1.
char_u b0_version[10]; /* Vim version string */
char_u b0_page_size[4]; /* number of bytes per page */
char_u b0_mtime[4]; /* last modification time of file */
@@ -619,22 +616,16 @@ void ml_timestamp(buf_T *buf)
ml_upd_block0(buf, UB_FNAME);
}
-/*
- * Return FAIL when the ID of "b0p" is wrong.
- */
-static int ml_check_b0_id(ZERO_BL *b0p)
+/// Checks whether the IDs in b0 are valid.
+static bool ml_check_b0_id(ZERO_BL *b0p)
+ FUNC_ATTR_NONNULL_ALL
{
- if (b0p->b0_id[0] != BLOCK0_ID0
- || (b0p->b0_id[1] != BLOCK0_ID1
- && b0p->b0_id[1] != BLOCK0_ID1_C0
- && b0p->b0_id[1] != BLOCK0_ID1_C1)
- )
- return FAIL;
- return OK;
+ return b0p->b0_id[0] == BLOCK0_ID0 && b0p->b0_id[1] == BLOCK0_ID1;
}
-/// Return true if all strings in b0 are correct (nul-terminated).
-static bool ml_check_b0_strings(ZERO_BL *b0p) FUNC_ATTR_NONNULL_ALL
+/// Checks whether all strings in b0 are valid (i.e. nul-terminated).
+static bool ml_check_b0_strings(ZERO_BL *b0p)
+ FUNC_ATTR_NONNULL_ALL
{
return (memchr(b0p->b0_version, NUL, 10)
&& memchr(b0p->b0_uname, NUL, B0_UNAME_SIZE)