FileID: remove CHECK_INODE macro

This commit is contained in:
Stefan Hoffmann
2014-05-28 15:19:55 +02:00
parent cc02c3537d
commit 147ab48d1c
2 changed files with 6 additions and 20 deletions

View File

@@ -686,16 +686,12 @@ static void set_b0_fname(ZERO_BL *b0p, buf_T *buf)
FileInfo file_info; FileInfo file_info;
if (os_get_file_info((char *)buf->b_ffname, &file_info)) { if (os_get_file_info((char *)buf->b_ffname, &file_info)) {
long_to_char((long)file_info.stat.st_mtim.tv_sec, b0p->b0_mtime); long_to_char((long)file_info.stat.st_mtim.tv_sec, b0p->b0_mtime);
#ifdef CHECK_INODE
long_to_char((long)os_file_info_get_inode(&file_info), b0p->b0_ino); long_to_char((long)os_file_info_get_inode(&file_info), b0p->b0_ino);
#endif
buf_store_file_info(buf, &file_info); buf_store_file_info(buf, &file_info);
buf->b_mtime_read = buf->b_mtime; buf->b_mtime_read = buf->b_mtime;
} else { } else {
long_to_char(0L, b0p->b0_mtime); long_to_char(0L, b0p->b0_mtime);
#ifdef CHECK_INODE
long_to_char(0L, b0p->b0_ino); long_to_char(0L, b0p->b0_ino);
#endif
buf->b_mtime = 0; buf->b_mtime = 0;
buf->b_mtime_read = 0; buf->b_mtime_read = 0;
buf->b_orig_size = 0; buf->b_orig_size = 0;
@@ -3341,30 +3337,25 @@ findswapname (
if (fnamecmp(path_tail(buf->b_ffname), if (fnamecmp(path_tail(buf->b_ffname),
path_tail(b0.b0_fname)) != 0 path_tail(b0.b0_fname)) != 0
|| !same_directory(fname, buf->b_ffname)) { || !same_directory(fname, buf->b_ffname)) {
#ifdef CHECK_INODE
/* Symlinks may point to the same file even /* Symlinks may point to the same file even
* when the name differs, need to check the * when the name differs, need to check the
* inode too. */ * inode too. */
expand_env(b0.b0_fname, NameBuff, MAXPATHL); expand_env(b0.b0_fname, NameBuff, MAXPATHL);
if (fnamecmp_ino(buf->b_ffname, NameBuff, if (fnamecmp_ino(buf->b_ffname, NameBuff,
char_to_long(b0.b0_ino))) char_to_long(b0.b0_ino))) {
#endif
differ = TRUE; differ = TRUE;
} }
}
} else { } else {
/* /*
* The name in the swap file may be * The name in the swap file may be
* "~user/path/file". Expand it first. * "~user/path/file". Expand it first.
*/ */
expand_env(b0.b0_fname, NameBuff, MAXPATHL); expand_env(b0.b0_fname, NameBuff, MAXPATHL);
#ifdef CHECK_INODE
if (fnamecmp_ino(buf->b_ffname, NameBuff, if (fnamecmp_ino(buf->b_ffname, NameBuff,
char_to_long(b0.b0_ino))) char_to_long(b0.b0_ino))) {
differ = TRUE; differ = TRUE;
#else }
if (fnamecmp(NameBuff, buf->b_ffname) != 0)
differ = TRUE;
#endif
} }
} }
close(fd); close(fd);
@@ -3504,7 +3495,6 @@ static int b0_magic_wrong(ZERO_BL *b0p)
|| b0p->b0_magic_char != B0_MAGIC_CHAR; || b0p->b0_magic_char != B0_MAGIC_CHAR;
} }
#ifdef CHECK_INODE
/* /*
* Compare current file name with file name from swap file. * Compare current file name with file name from swap file.
* Try to use inode numbers when possible. * Try to use inode numbers when possible.
@@ -3603,7 +3593,6 @@ fnamecmp_ino (
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
#endif /* CHECK_INODE */
/* /*
* Move a long integer into a four byte character array. * Move a long integer into a four byte character array.

View File

@@ -229,9 +229,6 @@
# define MAXPATHL 1024 # define MAXPATHL 1024
#endif #endif
// TODO(stefan991): remove macro
#define CHECK_INODE /* used when checking if a swap file already
exists for a file */
# ifndef DFLT_MAXMEM # ifndef DFLT_MAXMEM
# define DFLT_MAXMEM (5*1024) /* use up to 5 Mbyte for a buffer */ # define DFLT_MAXMEM (5*1024) /* use up to 5 Mbyte for a buffer */
# endif # endif