diff options
author | Stefan Hoffmann <stefan991@gmail.com> | 2014-05-27 20:24:55 +0200 |
---|---|---|
committer | Stefan Hoffmann <stefan991@gmail.com> | 2014-06-27 13:59:29 +0200 |
commit | 7340f619d72bdfd0a4ab456f728685bdef6b4d34 (patch) | |
tree | 59185fbd696933830ce5fb8e12fe83e149e7a58a | |
parent | d3257c4ddfa76d52c10b49a48992912def843dd9 (diff) | |
download | rneovim-7340f619d72bdfd0a4ab456f728685bdef6b4d34.tar.gz rneovim-7340f619d72bdfd0a4ab456f728685bdef6b4d34.tar.bz2 rneovim-7340f619d72bdfd0a4ab456f728685bdef6b4d34.zip |
FileID: refactor if_cscope.c to use `FileID`
-rw-r--r-- | src/nvim/if_cscope.c | 15 | ||||
-rw-r--r-- | src/nvim/if_cscope_defs.h | 7 |
2 files changed, 6 insertions, 16 deletions
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index ffc00f060a..73dac908e9 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -1139,14 +1139,7 @@ static void clear_csinfo(int i) csinfo[i].fname = NULL; csinfo[i].ppath = NULL; csinfo[i].flags = NULL; -#if defined(UNIX) - csinfo[i].st_dev = (dev_t)0; - csinfo[i].st_ino = (ino_t)0; -#else - csinfo[i].nVolume = 0; - csinfo[i].nIndexHigh = 0; - csinfo[i].nIndexLow = 0; -#endif + csinfo[i].file_id = FILE_ID_EMPTY; csinfo[i].pid = 0; csinfo[i].fr_fp = NULL; csinfo[i].to_fp = NULL; @@ -1181,8 +1174,7 @@ static int cs_insert_filelist(char *fname, char *ppath, char *flags, i = -1; /* can be set to the index of an empty item in csinfo */ for (j = 0; j < csinfo_size; j++) { if (csinfo[j].fname != NULL - && csinfo[j].st_dev == file_info->stat.st_dev - && csinfo[j].st_ino == file_info->stat.st_ino) { + && os_file_id_equal_file_info(&(csinfo[j].file_id), file_info)) { if (p_csverbose) (void)EMSG(_("E568: duplicate cscope database not added")); return -1; @@ -1225,8 +1217,7 @@ static int cs_insert_filelist(char *fname, char *ppath, char *flags, } else csinfo[i].flags = NULL; - csinfo[i].st_dev = file_info->stat.st_dev; - csinfo[i].st_ino = file_info->stat.st_ino; + os_file_info_get_id(file_info, &(csinfo[i].file_id)); return i; } /* cs_insert_filelist */ diff --git a/src/nvim/if_cscope_defs.h b/src/nvim/if_cscope_defs.h index 0ec9e30516..a0c84e8ba1 100644 --- a/src/nvim/if_cscope_defs.h +++ b/src/nvim/if_cscope_defs.h @@ -14,10 +14,10 @@ #if defined(UNIX) # include <sys/types.h> /* pid_t */ -# include <sys/stat.h> /* dev_t, ino_t */ -#else #endif +#include "nvim/os/fs_defs.h" + #define CSCOPE_SUCCESS 0 #define CSCOPE_FAILURE -1 @@ -52,8 +52,7 @@ typedef struct csi { #if defined(UNIX) pid_t pid; /* PID of the connected cscope process. */ #endif - uint64_t st_dev; /* ID of dev containing cscope db */ - uint64_t st_ino; /* inode number of cscope db */ + FileID file_id; FILE * fr_fp; /* from cscope: FILE. */ FILE * to_fp; /* to cscope: FILE. */ |