mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 23:38:17 +00:00
Remove instances of TRUE/FALSE macro
memory.c os_unix.c path.c
This commit is contained in:

committed by
Björn Linse

parent
ea33a75d07
commit
f7c5dc4db2
@@ -268,15 +268,15 @@ char_u *shorten_dir(char_u *str)
|
||||
* Also returns TRUE if there is no directory name.
|
||||
* "fname" must be writable!.
|
||||
*/
|
||||
int dir_of_file_exists(char_u *fname)
|
||||
bool dir_of_file_exists(char_u *fname)
|
||||
{
|
||||
char_u *p;
|
||||
int c;
|
||||
int retval;
|
||||
bool retval;
|
||||
|
||||
p = path_tail_with_sep(fname);
|
||||
if (p == fname)
|
||||
return TRUE;
|
||||
return true;
|
||||
c = *p;
|
||||
*p = NUL;
|
||||
retval = os_isdir(fname);
|
||||
@@ -510,7 +510,7 @@ static size_t do_path_expand(garray_T *gap, const char_u *path,
|
||||
int starts_with_dot;
|
||||
int matches;
|
||||
int len;
|
||||
int starstar = FALSE;
|
||||
bool starstar = false;
|
||||
static int stardepth = 0; /* depth for "**" expansion */
|
||||
|
||||
/* Expanding "**" may take a long time, check for CTRL-C. */
|
||||
@@ -570,7 +570,7 @@ static size_t do_path_expand(garray_T *gap, const char_u *path,
|
||||
/* Check for "**" between "s" and "e". */
|
||||
for (p = s; p < e; ++p)
|
||||
if (p[0] == '*' && p[1] == '*')
|
||||
starstar = TRUE;
|
||||
starstar = true;
|
||||
|
||||
/* convert the file pattern to a regexp pattern */
|
||||
starts_with_dot = (*s == '.');
|
||||
@@ -606,7 +606,7 @@ static size_t do_path_expand(garray_T *gap, const char_u *path,
|
||||
&& *path_end == '/') {
|
||||
STRCPY(s, path_end + 1);
|
||||
++stardepth;
|
||||
(void)do_path_expand(gap, buf, (int)(s - buf), flags, TRUE);
|
||||
(void)do_path_expand(gap, buf, (int)(s - buf), flags, true);
|
||||
--stardepth;
|
||||
}
|
||||
*s = NUL;
|
||||
@@ -688,7 +688,7 @@ static int find_previous_pathsep(char_u *path, char_u **psep)
|
||||
* Returns TRUE if "maybe_unique" is unique wrt other_paths in "gap".
|
||||
* "maybe_unique" is the end portion of "((char_u **)gap->ga_data)[i]".
|
||||
*/
|
||||
static int is_unique(char_u *maybe_unique, garray_T *gap, int i)
|
||||
static bool is_unique(char_u *maybe_unique, garray_T *gap, int i)
|
||||
{
|
||||
int candidate_len;
|
||||
int other_path_len;
|
||||
@@ -707,10 +707,10 @@ static int is_unique(char_u *maybe_unique, garray_T *gap, int i)
|
||||
rival = other_paths[j] + other_path_len - candidate_len;
|
||||
if (fnamecmp(maybe_unique, rival) == 0
|
||||
&& (rival == other_paths[j] || vim_ispathsep(*(rival - 1))))
|
||||
return FALSE; /* match */
|
||||
return false; /* match */
|
||||
}
|
||||
|
||||
return TRUE; /* no match found */
|
||||
return true; /* no match found */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -816,7 +816,7 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
|
||||
{
|
||||
int len;
|
||||
char_u **fnames = (char_u **)gap->ga_data;
|
||||
int sort_again = FALSE;
|
||||
bool sort_again = false;
|
||||
char_u *pat;
|
||||
char_u *file_pattern;
|
||||
char_u *curdir;
|
||||
@@ -878,7 +878,7 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
|
||||
if (vim_regexec(®match, pathsep_p + 1, (colnr_T)0)
|
||||
&& is_unique(pathsep_p + 1, gap, i)
|
||||
&& path_cutoff != NULL && pathsep_p + 1 >= path_cutoff) {
|
||||
sort_again = TRUE;
|
||||
sort_again = true;
|
||||
memmove(path, pathsep_p + 1, STRLEN(pathsep_p));
|
||||
break;
|
||||
}
|
||||
@@ -932,7 +932,7 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
|
||||
|
||||
xfree(fnames[i]);
|
||||
fnames[i] = rel_path;
|
||||
sort_again = TRUE;
|
||||
sort_again = true;
|
||||
os_breakcheck();
|
||||
}
|
||||
|
||||
@@ -957,19 +957,19 @@ static char_u *gettail_dir(char_u *fname)
|
||||
{
|
||||
char_u *dir_end = fname;
|
||||
char_u *next_dir_end = fname;
|
||||
int look_for_sep = TRUE;
|
||||
bool look_for_sep = true;
|
||||
char_u *p;
|
||||
|
||||
for (p = fname; *p != NUL; ) {
|
||||
if (vim_ispathsep(*p)) {
|
||||
if (look_for_sep) {
|
||||
next_dir_end = p;
|
||||
look_for_sep = FALSE;
|
||||
look_for_sep = false;
|
||||
}
|
||||
} else {
|
||||
if (!look_for_sep)
|
||||
dir_end = next_dir_end;
|
||||
look_for_sep = TRUE;
|
||||
look_for_sep = true;
|
||||
}
|
||||
mb_ptr_adv(p);
|
||||
}
|
||||
@@ -1016,7 +1016,7 @@ expand_in_path (
|
||||
* Return TRUE if "p" contains what looks like an environment variable.
|
||||
* Allowing for escaping.
|
||||
*/
|
||||
static int has_env_var(char_u *p)
|
||||
static bool has_env_var(char_u *p)
|
||||
{
|
||||
for (; *p; mb_ptr_adv(p)) {
|
||||
if (*p == '\\' && p[1] != NUL)
|
||||
@@ -1024,9 +1024,9 @@ static int has_env_var(char_u *p)
|
||||
else if (vim_strchr((char_u *)
|
||||
"$"
|
||||
, *p) != NULL)
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef SPECIAL_WILDCHAR
|
||||
@@ -1034,15 +1034,15 @@ static int has_env_var(char_u *p)
|
||||
* Return TRUE if "p" contains a special wildcard character.
|
||||
* Allowing for escaping.
|
||||
*/
|
||||
static int has_special_wildchar(char_u *p)
|
||||
static bool has_special_wildchar(char_u *p)
|
||||
{
|
||||
for (; *p; mb_ptr_adv(p)) {
|
||||
if (*p == '\\' && p[1] != NUL)
|
||||
++p;
|
||||
else if (vim_strchr((char_u *)SPECIAL_WILDCHAR, *p) != NULL)
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1070,9 +1070,9 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
||||
int i;
|
||||
garray_T ga;
|
||||
char_u *p;
|
||||
static int recursive = FALSE;
|
||||
static bool recursive = false;
|
||||
int add_pat;
|
||||
int did_expand_in_path = FALSE;
|
||||
bool did_expand_in_path = false;
|
||||
|
||||
/*
|
||||
* expand_env() is called to expand things like "~user". If this fails,
|
||||
@@ -1102,7 +1102,7 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
||||
}
|
||||
#endif
|
||||
|
||||
recursive = TRUE;
|
||||
recursive = true;
|
||||
|
||||
/*
|
||||
* The matching file names are stored in a growarray. Init it empty.
|
||||
@@ -1120,7 +1120,7 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
||||
* First expand environment variables, "~/" and "~user/".
|
||||
*/
|
||||
if (has_env_var(p) || *p == '~') {
|
||||
p = expand_env_save_opt(p, TRUE);
|
||||
p = expand_env_save_opt(p, true);
|
||||
if (p == NULL)
|
||||
p = pat[i];
|
||||
#ifdef UNIX
|
||||
@@ -1134,7 +1134,7 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
||||
ga_clear_strings(&ga);
|
||||
i = mch_expand_wildcards(num_pat, pat, num_file, file,
|
||||
flags | EW_KEEPDOLLAR);
|
||||
recursive = FALSE;
|
||||
recursive = false;
|
||||
return i;
|
||||
}
|
||||
#endif
|
||||
@@ -1156,12 +1156,13 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
||||
) {
|
||||
/* :find completion where 'path' is used.
|
||||
* Recursiveness is OK here. */
|
||||
recursive = FALSE;
|
||||
recursive = false;
|
||||
add_pat = expand_in_path(&ga, p, flags);
|
||||
recursive = TRUE;
|
||||
did_expand_in_path = TRUE;
|
||||
} else
|
||||
recursive = true;
|
||||
did_expand_in_path = true;
|
||||
} else {
|
||||
add_pat = path_expand(&ga, p, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1186,7 +1187,7 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
||||
*num_file = ga.ga_len;
|
||||
*file = (ga.ga_data != NULL) ? (char_u **)ga.ga_data : (char_u **)"";
|
||||
|
||||
recursive = FALSE;
|
||||
recursive = false;
|
||||
|
||||
return (ga.ga_data != NULL) ? OK : FAIL;
|
||||
}
|
||||
@@ -1312,8 +1313,8 @@ void simplify_filename(char_u *filename)
|
||||
{
|
||||
int components = 0;
|
||||
char_u *p, *tail, *start;
|
||||
int stripping_disabled = FALSE;
|
||||
int relative = TRUE;
|
||||
bool stripping_disabled = false;
|
||||
bool relative = true;
|
||||
|
||||
p = filename;
|
||||
#ifdef BACKSLASH_IN_FILENAME
|
||||
@@ -1322,7 +1323,7 @@ void simplify_filename(char_u *filename)
|
||||
#endif
|
||||
|
||||
if (vim_ispathsep(*p)) {
|
||||
relative = FALSE;
|
||||
relative = false;
|
||||
do
|
||||
++p;
|
||||
while (vim_ispathsep(*p));
|
||||
@@ -1358,7 +1359,7 @@ void simplify_filename(char_u *filename)
|
||||
mb_ptr_adv(tail);
|
||||
|
||||
if (components > 0) { /* strip one preceding component */
|
||||
int do_strip = FALSE;
|
||||
bool do_strip = false;
|
||||
char_u saved_char;
|
||||
|
||||
/* Don't strip for an erroneous file name. */
|
||||
@@ -1370,7 +1371,7 @@ void simplify_filename(char_u *filename)
|
||||
p[-1] = NUL;
|
||||
FileInfo file_info;
|
||||
if (!os_fileinfo_link((char *)filename, &file_info)) {
|
||||
do_strip = TRUE;
|
||||
do_strip = true;
|
||||
}
|
||||
p[-1] = saved_char;
|
||||
|
||||
@@ -1393,10 +1394,10 @@ void simplify_filename(char_u *filename)
|
||||
saved_char = *tail;
|
||||
*tail = NUL;
|
||||
if (os_fileinfo((char *)filename, &file_info)) {
|
||||
do_strip = TRUE;
|
||||
do_strip = true;
|
||||
} else {
|
||||
stripping_disabled = true;
|
||||
}
|
||||
else
|
||||
stripping_disabled = TRUE;
|
||||
*tail = saved_char;
|
||||
if (do_strip) {
|
||||
/* The check for the unstripped file name
|
||||
@@ -1417,7 +1418,7 @@ void simplify_filename(char_u *filename)
|
||||
}
|
||||
|
||||
if (!os_fileinfo_id_equal(&file_info, &new_file_info)) {
|
||||
do_strip = FALSE;
|
||||
do_strip = false;
|
||||
/* We don't disable stripping of later
|
||||
* components since the unstripped path name is
|
||||
* still valid. */
|
||||
@@ -1612,7 +1613,7 @@ int vim_FullName(const char *fname, char *buf, int len, bool force)
|
||||
char *fix_fname(char *fname)
|
||||
{
|
||||
#ifdef UNIX
|
||||
return FullName_save(fname, TRUE);
|
||||
return FullName_save(fname, true);
|
||||
#else
|
||||
if (!vim_isAbsName((char_u *)fname)
|
||||
|| strstr(fname, "..") != NULL
|
||||
@@ -1621,7 +1622,7 @@ char *fix_fname(char *fname)
|
||||
|| strstr(fname, "\\\\") != NULL
|
||||
# endif
|
||||
)
|
||||
return FullName_save(fname, FALSE);
|
||||
return FullName_save(fname, false);
|
||||
|
||||
fname = xstrdup(fname);
|
||||
|
||||
@@ -1703,7 +1704,7 @@ int after_pathsep(const char *b, const char *p)
|
||||
* Return TRUE if file names "f1" and "f2" are in the same directory.
|
||||
* "f1" may be a short name, "f2" must be a full path.
|
||||
*/
|
||||
int same_directory(char_u *f1, char_u *f2)
|
||||
bool same_directory(char_u *f1, char_u *f2)
|
||||
{
|
||||
char_u ffname[MAXPATHL];
|
||||
char_u *t1;
|
||||
@@ -1711,7 +1712,7 @@ int same_directory(char_u *f1, char_u *f2)
|
||||
|
||||
/* safety check */
|
||||
if (f1 == NULL || f2 == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
(void)vim_FullName((char *)f1, (char *)ffname, MAXPATHL, FALSE);
|
||||
t1 = path_tail_with_sep(ffname);
|
||||
|
Reference in New Issue
Block a user