Merge "Remove instances of TRUE/FALSE" #3272

This commit is contained in:
Björn Linse 2015-09-04 11:18:39 +02:00
commit c51864b826
12 changed files with 131 additions and 148 deletions

View File

@ -3625,7 +3625,7 @@ do_arg_all (
int opened_len; /* length of opened[] */ int opened_len; /* length of opened[] */
int use_firstwin = FALSE; /* use first window for arglist */ int use_firstwin = FALSE; /* use first window for arglist */
int split_ret = OK; int split_ret = OK;
int p_ea_save; bool p_ea_save;
alist_T *alist; /* argument list to be used */ alist_T *alist; /* argument list to be used */
buf_T *buf; buf_T *buf;
tabpage_T *tpnext; tabpage_T *tpnext;
@ -3792,7 +3792,7 @@ do_arg_all (
} else if (split_ret == OK) { } else if (split_ret == OK) {
if (!use_firstwin) { /* split current window */ if (!use_firstwin) { /* split current window */
p_ea_save = p_ea; p_ea_save = p_ea;
p_ea = TRUE; /* use space from all windows */ p_ea = true; /* use space from all windows */
split_ret = win_split(0, WSP_ROOM | WSP_BELOW); split_ret = win_split(0, WSP_ROOM | WSP_BELOW);
p_ea = p_ea_save; p_ea = p_ea_save;
if (split_ret == FAIL) if (split_ret == FAIL)
@ -3853,7 +3853,7 @@ void ex_buffer_all(exarg_T *eap)
buf_T *buf; buf_T *buf;
win_T *wp, *wpnext; win_T *wp, *wpnext;
int split_ret = OK; int split_ret = OK;
int p_ea_save; bool p_ea_save;
int open_wins = 0; int open_wins = 0;
int r; int r;
int count; /* Maximum number of windows to open. */ int count; /* Maximum number of windows to open. */
@ -3940,7 +3940,7 @@ void ex_buffer_all(exarg_T *eap)
if (wp == NULL && split_ret == OK) { if (wp == NULL && split_ret == OK) {
/* Split the window and put the buffer in it */ /* Split the window and put the buffer in it */
p_ea_save = p_ea; p_ea_save = p_ea;
p_ea = TRUE; /* use space from all windows */ p_ea = true; /* use space from all windows */
split_ret = win_split(0, WSP_ROOM | WSP_BELOW); split_ret = win_split(0, WSP_ROOM | WSP_BELOW);
++open_wins; ++open_wins;
p_ea = p_ea_save; p_ea = p_ea_save;

View File

@ -4429,16 +4429,16 @@ void ex_global(exarg_T *eap)
if (got_int) if (got_int)
MSG(_(e_interr)); MSG(_(e_interr));
else if (ndone == 0) { else if (ndone == 0) {
if (type == 'v') if (type == 'v') {
smsg(_("Pattern found in every line: %s"), pat); smsg(_("Pattern found in every line: %s"), pat);
else } else {
smsg(_("Pattern not found: %s"), pat); smsg(_("Pattern not found: %s"), pat);
}
} else { } else {
start_global_changes(); start_global_changes();
global_exe(cmd); global_exe(cmd);
end_global_changes(); end_global_changes();
} }
ml_clearmarked(); /* clear rest of the marks */ ml_clearmarked(); /* clear rest of the marks */
vim_regfree(regmatch.regprog); vim_regfree(regmatch.regprog);
} }

View File

@ -6088,11 +6088,11 @@ aucmd_prepbuf (
block_autocmds(); block_autocmds();
make_snapshot(SNAP_AUCMD_IDX); make_snapshot(SNAP_AUCMD_IDX);
save_ea = p_ea; save_ea = p_ea;
p_ea = FALSE; p_ea = false;
/* Prevent chdir() call in win_enter_ext(), through do_autochdir(). */ /* Prevent chdir() call in win_enter_ext(), through do_autochdir(). */
save_acd = p_acd; save_acd = p_acd;
p_acd = FALSE; p_acd = false;
(void)win_split_ins(0, WSP_TOP, aucmd_win, 0); (void)win_split_ins(0, WSP_TOP, aucmd_win, 0);
(void)win_comp_pos(); /* recompute window positions */ (void)win_comp_pos(); /* recompute window positions */

View File

@ -1737,7 +1737,7 @@ static void edit_buffers(mparm_T *parmp)
--autocmd_no_leave; --autocmd_no_leave;
TIME_MSG("editing files in windows"); TIME_MSG("editing files in windows");
if (parmp->window_count > 1 && parmp->window_layout != WIN_TABS) if (parmp->window_count > 1 && parmp->window_layout != WIN_TABS)
win_equal(curwin, FALSE, 'b'); /* adjust heights */ win_equal(curwin, false, 'b'); /* adjust heights */
} }
/* /*

View File

@ -437,7 +437,7 @@ void do_outofmem_msg(size_t size)
/* Must come first to avoid coming back here when printing the error /* Must come first to avoid coming back here when printing the error
* message fails, e.g. when setting v:errmsg. */ * message fails, e.g. when setting v:errmsg. */
did_outofmem_msg = TRUE; did_outofmem_msg = true;
EMSGU(_("E342: Out of memory! (allocating %" PRIu64 " bytes)"), size); EMSGU(_("E342: Out of memory! (allocating %" PRIu64 " bytes)"), size);
} }
@ -496,7 +496,7 @@ void free_all_mem(void)
block_autocmds(); block_autocmds();
/* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */ /* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */
p_ea = FALSE; p_ea = false;
if (first_tabpage->tp_next != NULL) if (first_tabpage->tp_next != NULL)
do_cmdline_cmd("tabonly!"); do_cmdline_cmd("tabonly!");
if (firstwin != lastwin) if (firstwin != lastwin)
@ -567,10 +567,10 @@ void free_all_mem(void)
/* Free all buffers. Reset 'autochdir' to avoid accessing things that /* Free all buffers. Reset 'autochdir' to avoid accessing things that
* were freed already. */ * were freed already. */
p_acd = FALSE; p_acd = false;
for (buf = firstbuf; buf != NULL; ) { for (buf = firstbuf; buf != NULL; ) {
nextbuf = buf->b_next; nextbuf = buf->b_next;
close_buffer(NULL, buf, DOBUF_WIPE, FALSE); close_buffer(NULL, buf, DOBUF_WIPE, false);
if (buf_valid(buf)) if (buf_valid(buf))
buf = nextbuf; /* didn't work, try next one */ buf = nextbuf; /* didn't work, try next one */
else else

View File

@ -2199,7 +2199,7 @@ unchanged (
int ff /* also reset 'fileformat' */ int ff /* also reset 'fileformat' */
) )
{ {
if (buf->b_changed || (ff && file_ff_differs(buf, FALSE))) { if (buf->b_changed || (ff && file_ff_differs(buf, false))) {
buf->b_changed = false; buf->b_changed = false;
ml_setflags(buf); ml_setflags(buf);
if (ff) if (ff)

View File

@ -1820,13 +1820,13 @@ static void didset_options(void)
/* initialize the table for 'iskeyword' et.al. */ /* initialize the table for 'iskeyword' et.al. */
(void)init_chartab(); (void)init_chartab();
(void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE); (void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, true);
(void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE); (void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, true);
(void)opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE); (void)opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, true);
(void)opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE); (void)opt_strings_flags(p_vop, p_ssop_values, &vop_flags, true);
(void)opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE); (void)opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, true);
(void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE); (void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, true);
(void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE); (void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, true);
(void)spell_check_msm(); (void)spell_check_msm();
(void)spell_check_sps(); (void)spell_check_sps();
(void)compile_cap_prog(curwin->w_s); (void)compile_cap_prog(curwin->w_s);
@ -2136,7 +2136,7 @@ did_set_string_option (
// make the local value empty: use the global value // make the local value empty: use the global value
*flags = 0; *flags = 0;
} else { } else {
if (opt_strings_flags(bkc, p_bkc_values, flags, TRUE) != OK) { if (opt_strings_flags(bkc, p_bkc_values, flags, true) != OK) {
errmsg = e_invarg; errmsg = e_invarg;
} }
@ -2144,7 +2144,7 @@ did_set_string_option (
+ ((*flags & BKC_YES) != 0) + ((*flags & BKC_YES) != 0)
+ ((*flags & BKC_NO) != 0) != 1) { + ((*flags & BKC_NO) != 0) != 1) {
// Must have exactly one of "auto", "yes" and "no". // Must have exactly one of "auto", "yes" and "no".
(void)opt_strings_flags(oldval, p_bkc_values, flags, TRUE); (void)opt_strings_flags(oldval, p_bkc_values, flags, true);
errmsg = e_invarg; errmsg = e_invarg;
} }
} }
@ -2211,20 +2211,16 @@ did_set_string_option (
else if (gvarp == &p_nf) { else if (gvarp == &p_nf) {
if (check_opt_strings(*varp, p_nf_values, TRUE) != OK) if (check_opt_strings(*varp, p_nf_values, TRUE) != OK)
errmsg = e_invarg; errmsg = e_invarg;
} } else if (varp == &p_ssop) { // 'sessionoptions'
/* 'sessionoptions' */ if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, true) != OK)
else if (varp == &p_ssop) {
if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE) != OK)
errmsg = e_invarg; errmsg = e_invarg;
if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR)) { if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR)) {
/* Don't allow both "sesdir" and "curdir". */ /* Don't allow both "sesdir" and "curdir". */
(void)opt_strings_flags(oldval, p_ssop_values, &ssop_flags, TRUE); (void)opt_strings_flags(oldval, p_ssop_values, &ssop_flags, true);
errmsg = e_invarg; errmsg = e_invarg;
} }
} } else if (varp == &p_vop) { // 'viewoptions'
/* 'viewoptions' */ if (opt_strings_flags(p_vop, p_ssop_values, &vop_flags, true) != OK)
else if (varp == &p_vop) {
if (opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE) != OK)
errmsg = e_invarg; errmsg = e_invarg;
} }
/* 'scrollopt' */ /* 'scrollopt' */
@ -2560,20 +2556,16 @@ did_set_string_option (
else if (varp == &p_mousem) { else if (varp == &p_mousem) {
if (check_opt_strings(p_mousem, p_mousem_values, FALSE) != OK) if (check_opt_strings(p_mousem, p_mousem_values, FALSE) != OK)
errmsg = e_invarg; errmsg = e_invarg;
} } else if (varp == &p_swb) { // 'switchbuf'
/* 'switchbuf' */ if (opt_strings_flags(p_swb, p_swb_values, &swb_flags, true) != OK)
else if (varp == &p_swb) {
if (opt_strings_flags(p_swb, p_swb_values, &swb_flags, TRUE) != OK)
errmsg = e_invarg; errmsg = e_invarg;
} }
/* 'debug' */ /* 'debug' */
else if (varp == &p_debug) { else if (varp == &p_debug) {
if (check_opt_strings(p_debug, p_debug_values, TRUE) != OK) if (check_opt_strings(p_debug, p_debug_values, TRUE) != OK)
errmsg = e_invarg; errmsg = e_invarg;
} } else if (varp == &p_dy) { // 'display'
/* 'display' */ if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, true) != OK)
else if (varp == &p_dy) {
if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE) != OK)
errmsg = e_invarg; errmsg = e_invarg;
else else
(void)init_chartab(); (void)init_chartab();
@ -2721,10 +2713,8 @@ did_set_string_option (
errmsg = e_invarg; errmsg = e_invarg;
} else if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK) } else if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK)
errmsg = e_invarg; errmsg = e_invarg;
} } else if (varp == &p_cmp) { // 'casemap'
/* 'casemap' */ if (opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, true) != OK)
else if (varp == &p_cmp) {
if (opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE) != OK)
errmsg = e_invarg; errmsg = e_invarg;
} }
/* 'diffopt' */ /* 'diffopt' */
@ -2761,11 +2751,10 @@ did_set_string_option (
/* 'commentstring' */ /* 'commentstring' */
else if (gvarp == &p_cms) { else if (gvarp == &p_cms) {
if (**varp != NUL && strstr((char *)*varp, "%s") == NULL) if (**varp != NUL && strstr((char *)*varp, "%s") == NULL)
errmsg = (char_u *)N_("E537: 'commentstring' must be empty or contain %s"); errmsg = (char_u *)N_(
} "E537: 'commentstring' must be empty or contain %s");
/* 'foldopen' */ } else if (varp == &p_fdo) { // 'foldopen'
else if (varp == &p_fdo) { if (opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, true) != OK)
if (opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE) != OK)
errmsg = e_invarg; errmsg = e_invarg;
} }
/* 'foldclose' */ /* 'foldclose' */
@ -2777,10 +2766,8 @@ did_set_string_option (
else if (gvarp == &curwin->w_allbuf_opt.wo_fdi) { else if (gvarp == &curwin->w_allbuf_opt.wo_fdi) {
if (foldmethodIsIndent(curwin)) if (foldmethodIsIndent(curwin))
foldUpdateAll(curwin); foldUpdateAll(curwin);
} } else if (varp == &p_ve) { // 'virtualedit'
/* 'virtualedit' */ if (opt_strings_flags(p_ve, p_ve_values, &ve_flags, true) != OK)
else if (varp == &p_ve) {
if (opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE) != OK)
errmsg = e_invarg; errmsg = e_invarg;
else if (STRCMP(p_ve, oldval) != 0) { else if (STRCMP(p_ve, oldval) != 0) {
/* Recompute cursor position in case the new 've' setting /* Recompute cursor position in case the new 've' setting
@ -3418,10 +3405,10 @@ set_bool_option (
else if ((int *)varp == &curwin->w_p_wrap) { else if ((int *)varp == &curwin->w_p_wrap) {
if (curwin->w_p_wrap) if (curwin->w_p_wrap)
curwin->w_leftcol = 0; curwin->w_leftcol = 0;
} else if ((int *)varp == &p_ea) { } else if ((bool *)varp == &p_ea) {
if (p_ea && !old_value) if (p_ea && !old_value)
win_equal(curwin, FALSE, 0); win_equal(curwin, false, 0);
} else if ((int *)varp == &p_acd) { } else if ((bool *)varp == &p_acd) {
/* Change directories when the 'acd' option is set now. */ /* Change directories when the 'acd' option is set now. */
do_autochdir(); do_autochdir();
} }
@ -6011,8 +5998,7 @@ static void fill_breakat_flags(void)
* Return OK for correct value, FAIL otherwise. * Return OK for correct value, FAIL otherwise.
* Empty is always OK. * Empty is always OK.
*/ */
static int static int check_opt_strings(
check_opt_strings (
char_u *val, char_u *val,
char **values, char **values,
int list /* when TRUE: accept a list of values */ int list /* when TRUE: accept a list of values */
@ -6028,12 +6014,11 @@ check_opt_strings (
* Return OK for correct value, FAIL otherwise. * Return OK for correct value, FAIL otherwise.
* Empty is always OK. * Empty is always OK.
*/ */
static int static int opt_strings_flags(
opt_strings_flags ( char_u *val, /* new value */
char_u *val, /* new value */
char **values, /* array of valid string values */ char **values, /* array of valid string values */
unsigned *flagp, unsigned *flagp,
int list /* when TRUE: accept a list of values */ bool list /* when TRUE: accept a list of values */
) )
{ {
unsigned int new_flags = 0; unsigned int new_flags = 0;
@ -6109,11 +6094,10 @@ static int check_opt_wim(void)
/* /*
* Check if backspacing over something is allowed. * Check if backspacing over something is allowed.
* The parameter what is one of the following: whatBS_INDENT, BS_EOL
* or BS_START
*/ */
int bool can_bs(int what)
can_bs (
int what /* BS_INDENT, BS_EOL or BS_START */
)
{ {
switch (*p_bs) { switch (*p_bs) {
case '2': return TRUE; case '2': return TRUE;
@ -6149,7 +6133,7 @@ void save_file_ff(buf_T *buf)
* When "ignore_empty" is true don't consider a new, empty buffer to be * When "ignore_empty" is true don't consider a new, empty buffer to be
* changed. * changed.
*/ */
int file_ff_differs(buf_T *buf, int ignore_empty) bool file_ff_differs(buf_T *buf, bool ignore_empty)
{ {
/* In a buffer that was never loaded the options are not valid. */ /* In a buffer that was never loaded the options are not valid. */
if (buf->b_flags & BF_NEVERLOADED) if (buf->b_flags & BF_NEVERLOADED)

View File

@ -266,7 +266,7 @@
*/ */
EXTERN long p_aleph; /* 'aleph' */ EXTERN long p_aleph; /* 'aleph' */
EXTERN int p_acd; /* 'autochdir' */ EXTERN bool p_acd; /* 'autochdir' */
EXTERN char_u *p_ambw; /* 'ambiwidth' */ EXTERN char_u *p_ambw; /* 'ambiwidth' */
EXTERN int p_ar; /* 'autoread' */ EXTERN int p_ar; /* 'autoread' */
EXTERN int p_aw; /* 'autowrite' */ EXTERN int p_aw; /* 'autowrite' */
@ -341,7 +341,7 @@ static char *(p_dy_values[]) = {"lastline", "uhex", NULL};
#define DY_UHEX 0x002 #define DY_UHEX 0x002
EXTERN int p_ed; /* 'edcompatible' */ EXTERN int p_ed; /* 'edcompatible' */
EXTERN char_u *p_ead; /* 'eadirection' */ EXTERN char_u *p_ead; /* 'eadirection' */
EXTERN int p_ea; /* 'equalalways' */ EXTERN bool p_ea; /* 'equalalways' */
EXTERN char_u *p_ep; /* 'equalprg' */ EXTERN char_u *p_ep; /* 'equalprg' */
EXTERN int p_eb; /* 'errorbells' */ EXTERN int p_eb; /* 'errorbells' */
EXTERN char_u *p_ef; /* 'errorfile' */ EXTERN char_u *p_ef; /* 'errorfile' */

View File

@ -171,11 +171,11 @@ int mch_nodetype(char_u *name)
void mch_exit(int r) void mch_exit(int r)
{ {
exiting = TRUE; exiting = true;
ui_builtin_stop(); ui_builtin_stop();
ui_flush(); ui_flush();
ml_close_all(TRUE); /* remove all memfiles */ ml_close_all(true); /* remove all memfiles */
event_teardown(); event_teardown();
stream_set_blocking(input_global_fd(), true); // normalize stream (#2598) stream_set_blocking(input_global_fd(), true); // normalize stream (#2598)
@ -237,8 +237,8 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file,
* directly */ * directly */
int shell_style = STYLE_ECHO; int shell_style = STYLE_ECHO;
int check_spaces; int check_spaces;
static int did_find_nul = FALSE; static bool did_find_nul = false;
int ampersent = FALSE; bool ampersent = false;
/* vimglob() function to define for Posix shell */ /* vimglob() function to define for Posix shell */
static char *sh_vimglob_func = static char *sh_vimglob_func =
"vimglob() { while [ $# -ge 1 ]; do echo \"$1\"; shift; done }; vimglob >"; "vimglob() { while [ $# -ge 1 ]; do echo \"$1\"; shift; done }; vimglob >";
@ -341,7 +341,7 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file,
while (p > command && ascii_iswhite(*p)) while (p > command && ascii_iswhite(*p))
--p; --p;
if (*p == '&') { /* remove trailing '&' */ if (*p == '&') { /* remove trailing '&' */
ampersent = TRUE; ampersent = true;
*p = ' '; *p = ' ';
} }
STRCAT(command, ">"); STRCAT(command, ">");
@ -366,7 +366,7 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file,
for (i = 0; i < num_pat; ++i) { for (i = 0; i < num_pat; ++i) {
/* Put a backslash before special /* Put a backslash before special
* characters, except inside ``. */ * characters, except inside ``. */
int intick = FALSE; bool intick = false;
p = command + STRLEN(command); p = command + STRLEN(command);
*p++ = ' '; *p++ = ' ';
@ -537,14 +537,14 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file,
* When we found a NUL once, we know zsh is OK, set did_find_nul and * When we found a NUL once, we know zsh is OK, set did_find_nul and
* don't check for spaces again. * don't check for spaces again.
*/ */
check_spaces = FALSE; check_spaces = false;
if (shell_style == STYLE_PRINT && !did_find_nul) { if (shell_style == STYLE_PRINT && !did_find_nul) {
/* If there is a NUL, set did_find_nul, else set check_spaces */ /* If there is a NUL, set did_find_nul, else set check_spaces */
buffer[len] = NUL; buffer[len] = NUL;
if (len && (int)STRLEN(buffer) < (int)len) if (len && (int)STRLEN(buffer) < (int)len)
did_find_nul = TRUE; did_find_nul = true;
else else
check_spaces = TRUE; check_spaces = true;
} }
/* /*
@ -665,22 +665,22 @@ static void save_patterns(int num_pat, char_u **pat, int *num_file,
*num_file = num_pat; *num_file = num_pat;
} }
static int have_wildcard(int num, char_u **file) static bool have_wildcard(int num, char_u **file)
{ {
int i; int i;
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
if (path_has_wildcard(file[i])) if (path_has_wildcard(file[i]))
return 1; return true;
return 0; return false;
} }
static int have_dollars(int num, char_u **file) static bool have_dollars(int num, char_u **file)
{ {
int i; int i;
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
if (vim_strchr(file[i], '$') != NULL) if (vim_strchr(file[i], '$') != NULL)
return TRUE; return true;
return FALSE; return false;
} }

View File

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

View File

@ -2799,14 +2799,14 @@ int bufIsChanged(buf_T *buf)
{ {
return return
!bt_dontwrite(buf) && !bt_dontwrite(buf) &&
(buf->b_changed || file_ff_differs(buf, TRUE)); (buf->b_changed || file_ff_differs(buf, true));
} }
int curbufIsChanged(void) int curbufIsChanged(void)
{ {
return return
!bt_dontwrite(curbuf) && !bt_dontwrite(curbuf) &&
(curbuf->b_changed || file_ff_differs(curbuf, TRUE)); (curbuf->b_changed || file_ff_differs(curbuf, true));
} }
/* /*

View File

@ -321,7 +321,7 @@ newwindow:
/* make all windows the same height */ /* make all windows the same height */
case '=': case '=':
win_equal(NULL, FALSE, 'b'); win_equal(NULL, false, 'b');
break; break;
/* increase current window height */ /* increase current window height */
@ -950,7 +950,7 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
* equalize the window sizes. * equalize the window sizes.
*/ */
if (do_equal || dir != 0) if (do_equal || dir != 0)
win_equal(wp, TRUE, win_equal(wp, true,
(flags & WSP_VERT) ? (dir == 'v' ? 'b' : 'h') (flags & WSP_VERT) ? (dir == 'v' ? 'b' : 'h')
: dir == 'h' ? 'b' : : dir == 'h' ? 'b' :
'v'); 'v');
@ -1331,7 +1331,7 @@ static void win_totop(int size, int flags)
if (!(flags & WSP_VERT)) { if (!(flags & WSP_VERT)) {
win_setheight(height); win_setheight(height);
if (p_ea) if (p_ea)
win_equal(curwin, TRUE, 'v'); win_equal(curwin, true, 'v');
} }
} }
@ -1393,12 +1393,11 @@ void win_move_after(win_T *win1, win_T *win2)
* 'next_curwin' will soon be the current window, make sure it has enough * 'next_curwin' will soon be the current window, make sure it has enough
* rows. * rows.
*/ */
void void win_equal(
win_equal ( win_T *next_curwin, // pointer to current window to be or NULL
win_T *next_curwin, /* pointer to current window to be or NULL */ bool current, // do only frame with current window
int current, /* do only frame with current window */ int dir // 'v' for vertically, 'h' for horizontally,
int dir /* 'v' for vertically, 'h' for horizontally, // 'b' for both, 0 for using p_ead
'b' for both, 0 for using p_ead */
) )
{ {
if (dir == 0) if (dir == 0)
@ -1414,10 +1413,9 @@ win_equal (
* The window "next_curwin" (if not NULL) should at least get the size from * The window "next_curwin" (if not NULL) should at least get the size from
* 'winheight' and 'winwidth' if possible. * 'winheight' and 'winwidth' if possible.
*/ */
static void static void win_equal_rec(
win_equal_rec (
win_T *next_curwin, /* pointer to current window to be or NULL */ win_T *next_curwin, /* pointer to current window to be or NULL */
int current, /* do only frame with current window */ bool current, /* do only frame with current window */
frame_T *topfr, /* frame to set size off */ frame_T *topfr, /* frame to set size off */
int dir, /* 'v', 'h' or 'b', see win_equal() */ int dir, /* 'v', 'h' or 'b', see win_equal() */
int col, /* horizontal position for frame */ int col, /* horizontal position for frame */
@ -1972,12 +1970,12 @@ int win_close(win_T *win, int free_buf)
} }
if (p_ea if (p_ea
&& (*p_ead == 'b' || *p_ead == dir) && (*p_ead == 'b' || *p_ead == dir)
) ) {
win_equal(curwin, TRUE, win_equal(curwin, true, dir);
dir } else {
);
else
win_comp_pos(); win_comp_pos();
}
if (close_curwin) { if (close_curwin) {
win_enter_ext(wp, false, TRUE, TRUE, TRUE); win_enter_ext(wp, false, TRUE, TRUE, TRUE);
if (other_buffer) if (other_buffer)