Rename FPC_* constants.

This commit is contained in:
Thomas Wienecke
2014-04-01 18:11:28 +02:00
committed by Thiago de Arruda
parent c454030478
commit bfa4490aac
12 changed files with 45 additions and 45 deletions

View File

@@ -3739,7 +3739,7 @@ do_arg_all (
if (i < alist->al_ga.ga_len
&& (AARGLIST(alist)[i].ae_fnum == buf->b_fnum
|| path_full_compare(alist_name(&AARGLIST(alist)[i]),
buf->b_ffname, TRUE) & FPC_SAME)) {
buf->b_ffname, TRUE) & kEqualFiles)) {
int weight = 1;
if (old_curtab == curtab) {

View File

@@ -5213,7 +5213,7 @@ void fix_help_buffer(void)
copy_option_part(&p, NameBuff, MAXPATHL, ",");
mustfree = FALSE;
rt = vim_getenv((char_u *)"VIMRUNTIME", &mustfree);
if (path_full_compare(rt, NameBuff, FALSE) != FPC_SAME) {
if (path_full_compare(rt, NameBuff, FALSE) != kEqualFiles) {
int fcount;
char_u **fnames;
FILE *fd;
@@ -5523,7 +5523,7 @@ helptags_one (
*/
ga_init(&ga, (int)sizeof(char_u *), 100);
if (add_help_tags || path_full_compare((char_u *)"$VIMRUNTIME/doc",
dir, FALSE) == FPC_SAME) {
dir, FALSE) == kEqualFiles) {
if (ga_grow(&ga, 1) == FAIL)
got_int = TRUE;
else {

View File

@@ -1693,7 +1693,7 @@ static int editing_arg_idx(win_T *win)
&& (win->w_buffer->b_ffname == NULL
|| !(path_full_compare(
alist_name(&WARGLIST(win)[win->w_arg_idx]),
win->w_buffer->b_ffname, TRUE) & FPC_SAME))));
win->w_buffer->b_ffname, TRUE) & kEqualFiles))));
}
/*
@@ -1713,7 +1713,7 @@ void check_arg_idx(win_T *win)
&& (win->w_buffer->b_fnum == GARGLIST[GARGCOUNT - 1].ae_fnum
|| (win->w_buffer->b_ffname != NULL
&& (path_full_compare(alist_name(&GARGLIST[GARGCOUNT - 1]),
win->w_buffer->b_ffname, TRUE) & FPC_SAME))))
win->w_buffer->b_ffname, TRUE) & kEqualFiles))))
arg_had_last = TRUE;
} else {
/* We are editing the current entry in the argument list.

View File

@@ -1303,7 +1303,7 @@ static int cs_insert_filelist(char *fname, char *ppath, char *flags, struct stat
&& csinfo[j].st_dev == sb->st_dev && csinfo[j].st_ino == sb->st_ino
#else
/* compare pathnames first */
&& ((path_full_compare(csinfo[j].fname, fname, FALSE) & FPC_SAME)
&& ((path_full_compare(csinfo[j].fname, fname, FALSE) & kEqualFiles)
/* if not Windows 9x, test index file attributes too */
|| (!mch_windows95()
&& csinfo[j].nVolume == bhfi.dwVolumeSerialNumber

View File

@@ -2049,18 +2049,18 @@ static void source_startup_scripts(mparm_T *parmp)
i = FAIL;
if (path_full_compare((char_u *)USR_VIMRC_FILE,
(char_u *)VIMRC_FILE, FALSE) != FPC_SAME
(char_u *)VIMRC_FILE, FALSE) != kEqualFiles
#ifdef USR_VIMRC_FILE2
&& path_full_compare((char_u *)USR_VIMRC_FILE2,
(char_u *)VIMRC_FILE, FALSE) != FPC_SAME
(char_u *)VIMRC_FILE, FALSE) != kEqualFiles
#endif
#ifdef USR_VIMRC_FILE3
&& path_full_compare((char_u *)USR_VIMRC_FILE3,
(char_u *)VIMRC_FILE, FALSE) != FPC_SAME
(char_u *)VIMRC_FILE, FALSE) != kEqualFiles
#endif
#ifdef SYS_VIMRC_FILE
&& path_full_compare((char_u *)SYS_VIMRC_FILE,
(char_u *)VIMRC_FILE, FALSE) != FPC_SAME
(char_u *)VIMRC_FILE, FALSE) != kEqualFiles
#endif
)
i = do_source((char_u *)VIMRC_FILE, TRUE, DOSO_VIMRC);
@@ -2074,10 +2074,10 @@ static void source_startup_scripts(mparm_T *parmp)
secure = 0;
#endif
if ( path_full_compare((char_u *)USR_EXRC_FILE,
(char_u *)EXRC_FILE, FALSE) != FPC_SAME
(char_u *)EXRC_FILE, FALSE) != kEqualFiles
#ifdef USR_EXRC_FILE2
&& path_full_compare((char_u *)USR_EXRC_FILE2,
(char_u *)EXRC_FILE, FALSE) != FPC_SAME
(char_u *)EXRC_FILE, FALSE) != kEqualFiles
#endif
)
(void)do_source((char_u *)EXRC_FILE, FALSE, DOSO_NONE);

View File

@@ -1646,7 +1646,7 @@ recover_names (
if (curbuf->b_ml.ml_mfp != NULL
&& (p = curbuf->b_ml.ml_mfp->mf_fname) != NULL) {
for (i = 0; i < num_files; ++i)
if (path_full_compare(p, files[i], TRUE) & FPC_SAME) {
if (path_full_compare(p, files[i], TRUE) & kEqualFiles) {
/* Remove the name from files[i]. Move further entries
* down. When the array becomes empty free it here, since
* FreeWild() won't be called below. */

View File

@@ -46,18 +46,18 @@ FileComparison path_full_compare(char_u *s1, char_u *s2, int checkname)
vim_FullName(exp1, full1, MAXPATHL, FALSE);
vim_FullName(s2, full2, MAXPATHL, FALSE);
if (fnamecmp(full1, full2) == 0) {
return FPC_SAMEX;
return kEqualFileNames;
}
}
return FPC_NOTX;
return kBothFilesMissing;
}
if (r1 != OK || r2 != OK) {
return FPC_DIFFX;
return kOneFileMissing;
}
if (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino) {
return FPC_SAME;
return kEqualFiles;
}
return FPC_DIFF;
return kDifferentFiles;
}
char_u *path_tail(char_u *fname)

View File

@@ -3,11 +3,11 @@
/// Return value for the comparison of two files. Also @see path_full_compare.
typedef enum file_comparison {
FPC_SAME = 1, ///< Both exist and are the same file.
FPC_DIFF = 2, ///< Both exist and are different files.
FPC_NOTX = 4, ///< Both don't exist.
FPC_DIFFX = 6, ///< One of them doesn't exist.
FPC_SAMEX = 7 ///< Both don't exist and file names are same.
kEqualFiles = 1, ///< Both exist and are the same file.
kDifferentFiles = 2, ///< Both exist and are different files.
kBothFilesMissing = 4, ///< Both don't exist.
kOneFileMissing = 6, ///< One of them doesn't exist.
kEqualFileNames = 7 ///< Both don't exist and file names are same.
} FileComparison;
/// Compare two file names.

View File

@@ -4094,7 +4094,7 @@ find_pattern_in_path (
i = old_files;
if (i == max_path_depth)
break;
if (path_full_compare(new_fname, files[i].name, TRUE) & FPC_SAME) {
if (path_full_compare(new_fname, files[i].name, TRUE) & kEqualFiles) {
if (type != CHECK_PATH &&
action == ACTION_SHOW_ALL && files[i].matched) {
msg_putchar('\n'); /* cursor below last one */

View File

@@ -3887,7 +3887,7 @@ char_u *did_set_spelllang(win_T *wp)
/* Check if we loaded this language before. */
for (slang = first_lang; slang != NULL; slang = slang->sl_next)
if (path_full_compare(lang, slang->sl_fname, FALSE) == FPC_SAME)
if (path_full_compare(lang, slang->sl_fname, FALSE) == kEqualFiles)
break;
} else {
filename = FALSE;
@@ -3932,7 +3932,7 @@ char_u *did_set_spelllang(win_T *wp)
* Loop over the languages, there can be several files for "lang".
*/
for (slang = first_lang; slang != NULL; slang = slang->sl_next)
if (filename ? path_full_compare(lang, slang->sl_fname, FALSE) == FPC_SAME
if (filename ? path_full_compare(lang, slang->sl_fname, FALSE) == kEqualFiles
: STRICMP(lang, slang->sl_name) == 0) {
region_mask = REGION_ALL;
if (!filename && region != NULL) {
@@ -3988,7 +3988,7 @@ char_u *did_set_spelllang(win_T *wp)
/* If it was already found above then skip it. */
for (c = 0; c < ga.ga_len; ++c) {
p = LANGP_ENTRY(ga, c)->lp_slang->sl_fname;
if (p != NULL && path_full_compare(spf_name, p, FALSE) == FPC_SAME)
if (p != NULL && path_full_compare(spf_name, p, FALSE) == kEqualFiles)
break;
}
if (c < ga.ga_len)
@@ -3997,7 +3997,7 @@ char_u *did_set_spelllang(win_T *wp)
/* Check if it was loaded already. */
for (slang = first_lang; slang != NULL; slang = slang->sl_next)
if (path_full_compare(spf_name, slang->sl_fname, FALSE) == FPC_SAME)
if (path_full_compare(spf_name, slang->sl_fname, FALSE) == kEqualFiles)
break;
if (slang == NULL) {
/* Not loaded, try loading it now. The language name includes the
@@ -4334,7 +4334,7 @@ spell_reload_one (
int didit = FALSE;
for (slang = first_lang; slang != NULL; slang = slang->sl_next) {
if (path_full_compare(fname, slang->sl_fname, FALSE) == FPC_SAME) {
if (path_full_compare(fname, slang->sl_fname, FALSE) == kEqualFiles) {
slang_clear(slang);
if (spell_load_file(fname, NULL, slang, FALSE) == NULL)
/* reloading failed, clear the language */
@@ -7679,7 +7679,7 @@ static void spell_make_sugfile(spellinfo_T *spin, char_u *wfname)
* It might have been done already by spell_reload_one().
*/
for (slang = first_lang; slang != NULL; slang = slang->sl_next)
if (path_full_compare(wfname, slang->sl_fname, FALSE) == FPC_SAME)
if (path_full_compare(wfname, slang->sl_fname, FALSE) == kEqualFiles)
break;
if (slang == NULL) {
spell_message(spin, (char_u *)_("Reading back spell file..."));

View File

@@ -2740,7 +2740,7 @@ static int test_for_current(char_u *fname, char_u *fname_end, char_u *tag_fname,
}
fullname = expand_tag_fname(fname, tag_fname, TRUE);
if (fullname != NULL) {
retval = (path_full_compare(fullname, buf_ffname, TRUE) & FPC_SAME);
retval = (path_full_compare(fullname, buf_ffname, TRUE) & kEqualFiles);
vim_free(fullname);
}
*fname_end = c;

View File

@@ -4,7 +4,7 @@ path = lib
ffi.cdef [[
typedef enum file_comparison {
FPC_SAME = 1, FPC_DIFF = 2, FPC_NOTX = 4, FPC_DIFFX = 6, FPC_SAMEX = 7
kEqualFiles = 1, kDifferentFiles = 2, kBothFilesMissing = 4, kOneFileMissing = 6, kEqualFileNames = 7
} FileComparison;
FileComparison path_full_compare(char_u *s1, char_u *s2, int checkname);
char_u *path_tail(char_u *fname);
@@ -13,7 +13,7 @@ char_u *path_next_component(char_u *fname);
]]
-- import constants parsed by ffi
{:FPC_SAME, :FPC_DIFF, :FPC_NOTX, :FPC_DIFFX, :FPC_SAMEX} = path
{:kEqualFiles, :kDifferentFiles, :kBothFilesMissing, :kOneFileMissing, :kEqualFileNames} = path
NULL = ffi.cast 'void*', 0
describe 'path function', ->
@@ -36,22 +36,22 @@ describe 'path function', ->
os.remove f1
os.remove f2
it 'returns FPC_SAME when passed the same file', ->
eq FPC_SAME, (path_full_compare f1, f1)
it 'returns kEqualFiles when passed the same file', ->
eq kEqualFiles, (path_full_compare f1, f1)
it 'returns FPC_SAMEX when files that dont exist and have same name', ->
eq FPC_SAMEX, (path_full_compare 'null.txt', 'null.txt', true)
it 'returns kEqualFileNames when files that dont exist and have same name', ->
eq kEqualFileNames, (path_full_compare 'null.txt', 'null.txt', true)
it 'returns FPC_NOTX when files that dont exist', ->
eq FPC_NOTX, (path_full_compare 'null.txt', 'null.txt')
it 'returns kBothFilesMissing when files that dont exist', ->
eq kBothFilesMissing, (path_full_compare 'null.txt', 'null.txt')
it 'returns FPC_DIFF when passed different files', ->
eq FPC_DIFF, (path_full_compare f1, f2)
eq FPC_DIFF, (path_full_compare f2, f1)
it 'returns kDifferentFiles when passed different files', ->
eq kDifferentFiles, (path_full_compare f1, f2)
eq kDifferentFiles, (path_full_compare f2, f1)
it 'returns FPC_DIFFX if only one does not exist', ->
eq FPC_DIFFX, (path_full_compare f1, 'null.txt')
eq FPC_DIFFX, (path_full_compare 'null.txt', f1)
it 'returns kOneFileMissing if only one does not exist', ->
eq kOneFileMissing, (path_full_compare f1, 'null.txt')
eq kOneFileMissing, (path_full_compare 'null.txt', f1)
describe 'path_tail', ->
path_tail = (file) ->