diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-08-21 21:09:07 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-08-21 21:09:07 +0200 |
commit | 47ad5656e1e4285a74e7e8e5d0f1f71cd554e25c (patch) | |
tree | f5cd3064f4d3dc00b73c46ba83df45c6430d9261 /src | |
parent | 00f123a56585363cd13f062fd3bb123efcfaa664 (diff) | |
download | vim-git-47ad5656e1e4285a74e7e8e5d0f1f71cd554e25c.tar.gz |
patch 8.1.0314: build failure without the +eval featurev8.1.0314
Problem: Build failure without the +eval feature. (Brenton Horne)
Solution: Add #ifdef. Also add the "dirty" item.
Diffstat (limited to 'src')
-rw-r--r-- | src/memline.c | 16 | ||||
-rw-r--r-- | src/testdir/test_swap.vim | 3 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 14 insertions, 7 deletions
diff --git a/src/memline.c b/src/memline.c index 660e89c11..3d82af081 100644 --- a/src/memline.c +++ b/src/memline.c @@ -2041,6 +2041,7 @@ make_percent_swname(char_u *dir, char_u *name) static int process_still_running; #endif +#if defined(FEAT_EVAL) || defined(PROTO) /* * Return information found in swapfile "fname" in dictionary "d". * This is used by the swapinfo() function. @@ -2055,11 +2056,12 @@ get_b0_dict(char_u *fname, dict_T *d) { if (read_eintr(fd, &b0, sizeof(b0)) == sizeof(b0)) { - if (b0_magic_wrong(&b0)) - { + if (ml_check_b0_id(&b0) == FAIL) dict_add_string(d, "error", - vim_strsave((char_u *)"magic number mismatch")); - } + vim_strsave((char_u *)"Not a swap file")); + else if (b0_magic_wrong(&b0)) + dict_add_string(d, "error", + vim_strsave((char_u *)"Magic number mismatch")); else { /* we have swap information */ @@ -2070,9 +2072,10 @@ get_b0_dict(char_u *fname, dict_T *d) dict_add_number(d, "pid", char_to_long(b0.b0_pid)); dict_add_number(d, "mtime", char_to_long(b0.b0_mtime)); -#ifdef CHECK_INODE + dict_add_number(d, "dirty", b0.b0_dirty ? 1 : 0); +# ifdef CHECK_INODE dict_add_number(d, "inode", char_to_long(b0.b0_ino)); -#endif +# endif } } else @@ -2083,6 +2086,7 @@ get_b0_dict(char_u *fname, dict_T *d) else dict_add_string(d, "error", vim_strsave((char_u *)"Cannot open file")); } +#endif /* * Give information about an existing swap file. diff --git a/src/testdir/test_swap.vim b/src/testdir/test_swap.vim index b0e2ec9aa..c12693c81 100644 --- a/src/testdir/test_swap.vim +++ b/src/testdir/test_swap.vim @@ -109,6 +109,7 @@ func Test_swapinfo() call assert_match('\w', info.user) call assert_equal(hostname(), info.host) call assert_match('Xswapinfo', info.fname) + call assert_match(0, info.dirty) call assert_equal(getpid(), info.pid) call assert_match('^\d*$', info.mtime) if has_key(info, 'inode') @@ -128,6 +129,6 @@ func Test_swapinfo() call writefile([repeat('x', 10000)], 'Xnotaswapfile') let info = swapinfo('Xnotaswapfile') - call assert_equal('magic number mismatch', info.error) + call assert_equal('Not a swap file', info.error) call delete('Xnotaswapfile') endfunc diff --git a/src/version.c b/src/version.c index d0052fa33..55d3ce33e 100644 --- a/src/version.c +++ b/src/version.c @@ -795,6 +795,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 314, +/**/ 313, /**/ 312, |