mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
FileID: refactor if_cscope.c to use FileID
This commit is contained in:
parent
d3257c4ddf
commit
7340f619d7
@ -1139,14 +1139,7 @@ static void clear_csinfo(int i)
|
|||||||
csinfo[i].fname = NULL;
|
csinfo[i].fname = NULL;
|
||||||
csinfo[i].ppath = NULL;
|
csinfo[i].ppath = NULL;
|
||||||
csinfo[i].flags = NULL;
|
csinfo[i].flags = NULL;
|
||||||
#if defined(UNIX)
|
csinfo[i].file_id = FILE_ID_EMPTY;
|
||||||
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].pid = 0;
|
csinfo[i].pid = 0;
|
||||||
csinfo[i].fr_fp = NULL;
|
csinfo[i].fr_fp = NULL;
|
||||||
csinfo[i].to_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 */
|
i = -1; /* can be set to the index of an empty item in csinfo */
|
||||||
for (j = 0; j < csinfo_size; j++) {
|
for (j = 0; j < csinfo_size; j++) {
|
||||||
if (csinfo[j].fname != NULL
|
if (csinfo[j].fname != NULL
|
||||||
&& csinfo[j].st_dev == file_info->stat.st_dev
|
&& os_file_id_equal_file_info(&(csinfo[j].file_id), file_info)) {
|
||||||
&& csinfo[j].st_ino == file_info->stat.st_ino) {
|
|
||||||
if (p_csverbose)
|
if (p_csverbose)
|
||||||
(void)EMSG(_("E568: duplicate cscope database not added"));
|
(void)EMSG(_("E568: duplicate cscope database not added"));
|
||||||
return -1;
|
return -1;
|
||||||
@ -1225,8 +1217,7 @@ static int cs_insert_filelist(char *fname, char *ppath, char *flags,
|
|||||||
} else
|
} else
|
||||||
csinfo[i].flags = NULL;
|
csinfo[i].flags = NULL;
|
||||||
|
|
||||||
csinfo[i].st_dev = file_info->stat.st_dev;
|
os_file_info_get_id(file_info, &(csinfo[i].file_id));
|
||||||
csinfo[i].st_ino = file_info->stat.st_ino;
|
|
||||||
return i;
|
return i;
|
||||||
} /* cs_insert_filelist */
|
} /* cs_insert_filelist */
|
||||||
|
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
#if defined(UNIX)
|
#if defined(UNIX)
|
||||||
# include <sys/types.h> /* pid_t */
|
# include <sys/types.h> /* pid_t */
|
||||||
# include <sys/stat.h> /* dev_t, ino_t */
|
|
||||||
#else
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "nvim/os/fs_defs.h"
|
||||||
|
|
||||||
#define CSCOPE_SUCCESS 0
|
#define CSCOPE_SUCCESS 0
|
||||||
#define CSCOPE_FAILURE -1
|
#define CSCOPE_FAILURE -1
|
||||||
|
|
||||||
@ -52,8 +52,7 @@ typedef struct csi {
|
|||||||
#if defined(UNIX)
|
#if defined(UNIX)
|
||||||
pid_t pid; /* PID of the connected cscope process. */
|
pid_t pid; /* PID of the connected cscope process. */
|
||||||
#endif
|
#endif
|
||||||
uint64_t st_dev; /* ID of dev containing cscope db */
|
FileID file_id;
|
||||||
uint64_t st_ino; /* inode number of cscope db */
|
|
||||||
|
|
||||||
FILE * fr_fp; /* from cscope: FILE. */
|
FILE * fr_fp; /* from cscope: FILE. */
|
||||||
FILE * to_fp; /* to cscope: FILE. */
|
FILE * to_fp; /* to cscope: FILE. */
|
||||||
|
Loading…
Reference in New Issue
Block a user