0
0
mirror of https://github.com/vim/vim.git synced 2025-07-24 10:45:12 -04:00

patch 8.1.0314: build failure without the +eval feature

Problem:    Build failure without the +eval feature. (Brenton Horne)
Solution:   Add #ifdef.  Also add the "dirty" item.
This commit is contained in:
Bram Moolenaar 2018-08-21 21:09:07 +02:00
parent 00f123a565
commit 47ad5656e1
4 changed files with 17 additions and 8 deletions

View File

@ -8013,10 +8013,12 @@ swapinfo({fname}) swapinfo()
file file
mtime last modification time in seconds mtime last modification time in seconds
inode Optional: INODE number of the file inode Optional: INODE number of the file
dirty 1 if file was modified, 0 if not
In case of failure an "error" item is added with the reason: In case of failure an "error" item is added with the reason:
Cannot open file: file not found or in accessible Cannot open file: file not found or in accessible
Cannot read file: cannot read first block Cannot read file: cannot read first block
magic number mismatch: info in first block is invalid Not a swap file: does not contain correct block ID
Magic number mismatch: Info in first block is invalid
synID({lnum}, {col}, {trans}) *synID()* synID({lnum}, {col}, {trans}) *synID()*
The result is a Number, which is the syntax ID at the position The result is a Number, which is the syntax ID at the position

View File

@ -2041,6 +2041,7 @@ make_percent_swname(char_u *dir, char_u *name)
static int process_still_running; static int process_still_running;
#endif #endif
#if defined(FEAT_EVAL) || defined(PROTO)
/* /*
* Return information found in swapfile "fname" in dictionary "d". * Return information found in swapfile "fname" in dictionary "d".
* This is used by the swapinfo() function. * 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 (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", 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 else
{ {
/* we have swap information */ /* 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, "pid", char_to_long(b0.b0_pid));
dict_add_number(d, "mtime", char_to_long(b0.b0_mtime)); 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)); dict_add_number(d, "inode", char_to_long(b0.b0_ino));
#endif # endif
} }
} }
else else
@ -2083,6 +2086,7 @@ get_b0_dict(char_u *fname, dict_T *d)
else else
dict_add_string(d, "error", vim_strsave((char_u *)"Cannot open file")); dict_add_string(d, "error", vim_strsave((char_u *)"Cannot open file"));
} }
#endif
/* /*
* Give information about an existing swap file. * Give information about an existing swap file.

View File

@ -109,6 +109,7 @@ func Test_swapinfo()
call assert_match('\w', info.user) call assert_match('\w', info.user)
call assert_equal(hostname(), info.host) call assert_equal(hostname(), info.host)
call assert_match('Xswapinfo', info.fname) call assert_match('Xswapinfo', info.fname)
call assert_match(0, info.dirty)
call assert_equal(getpid(), info.pid) call assert_equal(getpid(), info.pid)
call assert_match('^\d*$', info.mtime) call assert_match('^\d*$', info.mtime)
if has_key(info, 'inode') if has_key(info, 'inode')
@ -128,6 +129,6 @@ func Test_swapinfo()
call writefile([repeat('x', 10000)], 'Xnotaswapfile') call writefile([repeat('x', 10000)], 'Xnotaswapfile')
let info = swapinfo('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') call delete('Xnotaswapfile')
endfunc endfunc

View File

@ -794,6 +794,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
314,
/**/ /**/
313, 313,
/**/ /**/