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

View File

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

View File

@@ -1693,7 +1693,7 @@ static int editing_arg_idx(win_T *win)
&& (win->w_buffer->b_ffname == NULL && (win->w_buffer->b_ffname == NULL
|| !(path_full_compare( || !(path_full_compare(
alist_name(&WARGLIST(win)[win->w_arg_idx]), 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_fnum == GARGLIST[GARGCOUNT - 1].ae_fnum
|| (win->w_buffer->b_ffname != NULL || (win->w_buffer->b_ffname != NULL
&& (path_full_compare(alist_name(&GARGLIST[GARGCOUNT - 1]), && (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; arg_had_last = TRUE;
} else { } else {
/* We are editing the current entry in the argument list. /* 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 && csinfo[j].st_dev == sb->st_dev && csinfo[j].st_ino == sb->st_ino
#else #else
/* compare pathnames first */ /* 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 */ /* if not Windows 9x, test index file attributes too */
|| (!mch_windows95() || (!mch_windows95()
&& csinfo[j].nVolume == bhfi.dwVolumeSerialNumber && csinfo[j].nVolume == bhfi.dwVolumeSerialNumber

View File

@@ -2049,18 +2049,18 @@ static void source_startup_scripts(mparm_T *parmp)
i = FAIL; i = FAIL;
if (path_full_compare((char_u *)USR_VIMRC_FILE, 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 #ifdef USR_VIMRC_FILE2
&& path_full_compare((char_u *)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 #endif
#ifdef USR_VIMRC_FILE3 #ifdef USR_VIMRC_FILE3
&& path_full_compare((char_u *)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 #endif
#ifdef SYS_VIMRC_FILE #ifdef SYS_VIMRC_FILE
&& path_full_compare((char_u *)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 #endif
) )
i = do_source((char_u *)VIMRC_FILE, TRUE, DOSO_VIMRC); i = do_source((char_u *)VIMRC_FILE, TRUE, DOSO_VIMRC);
@@ -2074,10 +2074,10 @@ static void source_startup_scripts(mparm_T *parmp)
secure = 0; secure = 0;
#endif #endif
if ( path_full_compare((char_u *)USR_EXRC_FILE, 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 #ifdef USR_EXRC_FILE2
&& path_full_compare((char_u *)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 #endif
) )
(void)do_source((char_u *)EXRC_FILE, FALSE, DOSO_NONE); (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 if (curbuf->b_ml.ml_mfp != NULL
&& (p = curbuf->b_ml.ml_mfp->mf_fname) != NULL) { && (p = curbuf->b_ml.ml_mfp->mf_fname) != NULL) {
for (i = 0; i < num_files; ++i) 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 /* Remove the name from files[i]. Move further entries
* down. When the array becomes empty free it here, since * down. When the array becomes empty free it here, since
* FreeWild() won't be called below. */ * 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(exp1, full1, MAXPATHL, FALSE);
vim_FullName(s2, full2, MAXPATHL, FALSE); vim_FullName(s2, full2, MAXPATHL, FALSE);
if (fnamecmp(full1, full2) == 0) { if (fnamecmp(full1, full2) == 0) {
return FPC_SAMEX; return kEqualFileNames;
} }
} }
return FPC_NOTX; return kBothFilesMissing;
} }
if (r1 != OK || r2 != OK) { if (r1 != OK || r2 != OK) {
return FPC_DIFFX; return kOneFileMissing;
} }
if (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino) { 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) 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. /// Return value for the comparison of two files. Also @see path_full_compare.
typedef enum file_comparison { typedef enum file_comparison {
FPC_SAME = 1, ///< Both exist and are the same file. kEqualFiles = 1, ///< Both exist and are the same file.
FPC_DIFF = 2, ///< Both exist and are different files. kDifferentFiles = 2, ///< Both exist and are different files.
FPC_NOTX = 4, ///< Both don't exist. kBothFilesMissing = 4, ///< Both don't exist.
FPC_DIFFX = 6, ///< One of them doesn't exist. kOneFileMissing = 6, ///< One of them doesn't exist.
FPC_SAMEX = 7 ///< Both don't exist and file names are same. kEqualFileNames = 7 ///< Both don't exist and file names are same.
} FileComparison; } FileComparison;
/// Compare two file names. /// Compare two file names.

View File

@@ -4094,7 +4094,7 @@ find_pattern_in_path (
i = old_files; i = old_files;
if (i == max_path_depth) if (i == max_path_depth)
break; 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 && if (type != CHECK_PATH &&
action == ACTION_SHOW_ALL && files[i].matched) { action == ACTION_SHOW_ALL && files[i].matched) {
msg_putchar('\n'); /* cursor below last one */ 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. */ /* Check if we loaded this language before. */
for (slang = first_lang; slang != NULL; slang = slang->sl_next) 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; break;
} else { } else {
filename = FALSE; 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". * Loop over the languages, there can be several files for "lang".
*/ */
for (slang = first_lang; slang != NULL; slang = slang->sl_next) 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) { : STRICMP(lang, slang->sl_name) == 0) {
region_mask = REGION_ALL; region_mask = REGION_ALL;
if (!filename && region != NULL) { 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. */ /* If it was already found above then skip it. */
for (c = 0; c < ga.ga_len; ++c) { for (c = 0; c < ga.ga_len; ++c) {
p = LANGP_ENTRY(ga, c)->lp_slang->sl_fname; 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; break;
} }
if (c < ga.ga_len) if (c < ga.ga_len)
@@ -3997,7 +3997,7 @@ char_u *did_set_spelllang(win_T *wp)
/* Check if it was loaded already. */ /* Check if it was loaded already. */
for (slang = first_lang; slang != NULL; slang = slang->sl_next) 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; break;
if (slang == NULL) { if (slang == NULL) {
/* Not loaded, try loading it now. The language name includes the /* Not loaded, try loading it now. The language name includes the
@@ -4334,7 +4334,7 @@ spell_reload_one (
int didit = FALSE; int didit = FALSE;
for (slang = first_lang; slang != NULL; slang = slang->sl_next) { 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); slang_clear(slang);
if (spell_load_file(fname, NULL, slang, FALSE) == NULL) if (spell_load_file(fname, NULL, slang, FALSE) == NULL)
/* reloading failed, clear the language */ /* 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(). * It might have been done already by spell_reload_one().
*/ */
for (slang = first_lang; slang != NULL; slang = slang->sl_next) 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; break;
if (slang == NULL) { if (slang == NULL) {
spell_message(spin, (char_u *)_("Reading back spell file...")); 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); fullname = expand_tag_fname(fname, tag_fname, TRUE);
if (fullname != NULL) { 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); vim_free(fullname);
} }
*fname_end = c; *fname_end = c;

View File

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