diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 2f87c9cbd2..b212e75283 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -3625,7 +3625,7 @@ do_arg_all ( int opened_len; /* length of opened[] */ int use_firstwin = FALSE; /* use first window for arglist */ int split_ret = OK; - int p_ea_save; + bool p_ea_save; alist_T *alist; /* argument list to be used */ buf_T *buf; tabpage_T *tpnext; @@ -3792,7 +3792,7 @@ do_arg_all ( } else if (split_ret == OK) { if (!use_firstwin) { /* split current window */ 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); p_ea = p_ea_save; if (split_ret == FAIL) @@ -3853,7 +3853,7 @@ void ex_buffer_all(exarg_T *eap) buf_T *buf; win_T *wp, *wpnext; int split_ret = OK; - int p_ea_save; + bool p_ea_save; int open_wins = 0; int r; 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) { /* Split the window and put the buffer in it */ 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); ++open_wins; p_ea = p_ea_save; diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 1e150444d0..c00b7012d1 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -4429,16 +4429,15 @@ void ex_global(exarg_T *eap) if (got_int) MSG(_(e_interr)); else if (ndone == 0) { - if (type == 'v') + if (type == 'v') { smsg(_("Pattern found in every line: %s"), pat); - else + } else { smsg(_("Pattern not found: %s"), pat); } else { start_global_changes(); global_exe(cmd); end_global_changes(); } - ml_clearmarked(); /* clear rest of the marks */ vim_regfree(regmatch.regprog); } diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 732ea610ee..acdef5cd12 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -6088,11 +6088,11 @@ aucmd_prepbuf ( block_autocmds(); make_snapshot(SNAP_AUCMD_IDX); save_ea = p_ea; - p_ea = FALSE; + p_ea = false; /* Prevent chdir() call in win_enter_ext(), through do_autochdir(). */ save_acd = p_acd; - p_acd = FALSE; + p_acd = false; (void)win_split_ins(0, WSP_TOP, aucmd_win, 0); (void)win_comp_pos(); /* recompute window positions */ diff --git a/src/nvim/main.c b/src/nvim/main.c index 9af15924bd..3e096ee190 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1737,7 +1737,7 @@ static void edit_buffers(mparm_T *parmp) --autocmd_no_leave; TIME_MSG("editing files in windows"); if (parmp->window_count > 1 && parmp->window_layout != WIN_TABS) - win_equal(curwin, FALSE, 'b'); /* adjust heights */ + win_equal(curwin, false, 'b'); /* adjust heights */ } /* diff --git a/src/nvim/memory.c b/src/nvim/memory.c index 85d56e3b90..132c895997 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -437,7 +437,7 @@ void do_outofmem_msg(size_t size) /* Must come first to avoid coming back here when printing the error * 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); } @@ -496,7 +496,7 @@ void free_all_mem(void) block_autocmds(); /* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */ - p_ea = FALSE; + p_ea = false; if (first_tabpage->tp_next != NULL) do_cmdline_cmd("tabonly!"); if (firstwin != lastwin) @@ -567,10 +567,10 @@ void free_all_mem(void) /* Free all buffers. Reset 'autochdir' to avoid accessing things that * were freed already. */ - p_acd = FALSE; + p_acd = false; for (buf = firstbuf; buf != NULL; ) { nextbuf = buf->b_next; - close_buffer(NULL, buf, DOBUF_WIPE, FALSE); + close_buffer(NULL, buf, DOBUF_WIPE, false); if (buf_valid(buf)) buf = nextbuf; /* didn't work, try next one */ else diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 4f23b3da63..6358651171 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -2199,7 +2199,7 @@ unchanged ( 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; ml_setflags(buf); if (ff) diff --git a/src/nvim/option.c b/src/nvim/option.c index ee50567728..71ca36c7e2 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1820,13 +1820,13 @@ static void didset_options(void) /* initialize the table for 'iskeyword' et.al. */ (void)init_chartab(); - (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_ssop, p_ssop_values, &ssop_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_dy, p_dy_values, &dy_flags, TRUE); - (void)opt_strings_flags(p_ve, p_ve_values, &ve_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_ssop, p_ssop_values, &ssop_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_dy, p_dy_values, &dy_flags, true); + (void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, true); (void)spell_check_msm(); (void)spell_check_sps(); (void)compile_cap_prog(curwin->w_s); @@ -2136,7 +2136,7 @@ did_set_string_option ( // make the local value empty: use the global value *flags = 0; } 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; } @@ -2144,7 +2144,7 @@ did_set_string_option ( + ((*flags & BKC_YES) != 0) + ((*flags & BKC_NO) != 0) != 1) { // 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; } } @@ -2214,17 +2214,17 @@ did_set_string_option ( } /* 'sessionoptions' */ else if (varp == &p_ssop) { - if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, TRUE) != OK) + if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, true) != OK) errmsg = e_invarg; if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR)) { /* 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; } } /* 'viewoptions' */ else if (varp == &p_vop) { - if (opt_strings_flags(p_vop, p_ssop_values, &vop_flags, TRUE) != OK) + if (opt_strings_flags(p_vop, p_ssop_values, &vop_flags, true) != OK) errmsg = e_invarg; } /* 'scrollopt' */ @@ -2563,7 +2563,7 @@ did_set_string_option ( } /* 'switchbuf' */ else if (varp == &p_swb) { - if (opt_strings_flags(p_swb, p_swb_values, &swb_flags, TRUE) != OK) + if (opt_strings_flags(p_swb, p_swb_values, &swb_flags, true) != OK) errmsg = e_invarg; } /* 'debug' */ @@ -2573,7 +2573,7 @@ did_set_string_option ( } /* 'display' */ else if (varp == &p_dy) { - if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE) != OK) + if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, true) != OK) errmsg = e_invarg; else (void)init_chartab(); @@ -2724,7 +2724,7 @@ did_set_string_option ( } /* 'casemap' */ else if (varp == &p_cmp) { - if (opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE) != OK) + if (opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, true) != OK) errmsg = e_invarg; } /* 'diffopt' */ @@ -2765,7 +2765,7 @@ did_set_string_option ( } /* '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; } /* 'foldclose' */ @@ -2780,7 +2780,7 @@ did_set_string_option ( } /* 'virtualedit' */ else if (varp == &p_ve) { - if (opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE) != OK) + if (opt_strings_flags(p_ve, p_ve_values, &ve_flags, true) != OK) errmsg = e_invarg; else if (STRCMP(p_ve, oldval) != 0) { /* Recompute cursor position in case the new 've' setting @@ -3418,10 +3418,10 @@ set_bool_option ( else if ((int *)varp == &curwin->w_p_wrap) { if (curwin->w_p_wrap) curwin->w_leftcol = 0; - } else if ((int *)varp == &p_ea) { + } else if ((bool *)varp == &p_ea) { if (p_ea && !old_value) - win_equal(curwin, FALSE, 0); - } else if ((int *)varp == &p_acd) { + win_equal(curwin, false, 0); + } else if ((bool *)varp == &p_acd) { /* Change directories when the 'acd' option is set now. */ do_autochdir(); } @@ -6011,8 +6011,7 @@ static void fill_breakat_flags(void) * Return OK for correct value, FAIL otherwise. * Empty is always OK. */ -static int -check_opt_strings ( +static int check_opt_strings( char_u *val, char **values, int list /* when TRUE: accept a list of values */ @@ -6028,12 +6027,11 @@ check_opt_strings ( * Return OK for correct value, FAIL otherwise. * Empty is always OK. */ -static int -opt_strings_flags ( - char_u *val, /* new value */ +static int opt_strings_flags( + char_u *val, /* new value */ char **values, /* array of valid string values */ 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; @@ -6109,11 +6107,10 @@ static int check_opt_wim(void) /* * Check if backspacing over something is allowed. + * The parameter what is one of the following: whatBS_INDENT, BS_EOL + * or BS_START */ -int -can_bs ( - int what /* BS_INDENT, BS_EOL or BS_START */ -) +bool can_bs(int what) { switch (*p_bs) { case '2': return TRUE; @@ -6149,7 +6146,7 @@ void save_file_ff(buf_T *buf) * When "ignore_empty" is true don't consider a new, empty buffer to be * 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. */ if (buf->b_flags & BF_NEVERLOADED) diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index e35f8bc55b..5340f4bdd5 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -266,7 +266,7 @@ */ EXTERN long p_aleph; /* 'aleph' */ -EXTERN int p_acd; /* 'autochdir' */ +EXTERN bool p_acd; /* 'autochdir' */ EXTERN char_u *p_ambw; /* 'ambiwidth' */ EXTERN int p_ar; /* 'autoread' */ EXTERN int p_aw; /* 'autowrite' */ @@ -341,7 +341,7 @@ static char *(p_dy_values[]) = {"lastline", "uhex", NULL}; #define DY_UHEX 0x002 EXTERN int p_ed; /* 'edcompatible' */ EXTERN char_u *p_ead; /* 'eadirection' */ -EXTERN int p_ea; /* 'equalalways' */ +EXTERN bool p_ea; /* 'equalalways' */ EXTERN char_u *p_ep; /* 'equalprg' */ EXTERN int p_eb; /* 'errorbells' */ EXTERN char_u *p_ef; /* 'errorfile' */ diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c index 122b3a171d..828ccd556d 100644 --- a/src/nvim/os_unix.c +++ b/src/nvim/os_unix.c @@ -171,11 +171,11 @@ int mch_nodetype(char_u *name) void mch_exit(int r) { - exiting = TRUE; + exiting = true; ui_builtin_stop(); ui_flush(); - ml_close_all(TRUE); /* remove all memfiles */ + ml_close_all(true); /* remove all memfiles */ event_teardown(); 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 */ int shell_style = STYLE_ECHO; int check_spaces; - static int did_find_nul = FALSE; - int ampersent = FALSE; + static bool did_find_nul = false; + bool ampersent = false; /* vimglob() function to define for Posix shell */ static char *sh_vimglob_func = "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)) --p; if (*p == '&') { /* remove trailing '&' */ - ampersent = TRUE; + ampersent = true; *p = ' '; } 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) { /* Put a backslash before special * characters, except inside ``. */ - int intick = FALSE; + bool intick = false; p = command + STRLEN(command); *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 * don't check for spaces again. */ - check_spaces = FALSE; + check_spaces = false; if (shell_style == STYLE_PRINT && !did_find_nul) { /* If there is a NUL, set did_find_nul, else set check_spaces */ buffer[len] = NUL; if (len && (int)STRLEN(buffer) < (int)len) - did_find_nul = TRUE; + did_find_nul = true; 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; } -static int have_wildcard(int num, char_u **file) +static bool have_wildcard(int num, char_u **file) { int i; for (i = 0; i < num; i++) if (path_has_wildcard(file[i])) - return 1; - return 0; + return true; + return false; } -static int have_dollars(int num, char_u **file) +static bool have_dollars(int num, char_u **file) { int i; for (i = 0; i < num; i++) if (vim_strchr(file[i], '$') != NULL) - return TRUE; - return FALSE; + return true; + return false; } diff --git a/src/nvim/path.c b/src/nvim/path.c index 72980fcd0e..f68cb46f33 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -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); diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 36b629b0b5..063c13084d 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -2799,14 +2799,14 @@ int bufIsChanged(buf_T *buf) { return !bt_dontwrite(buf) && - (buf->b_changed || file_ff_differs(buf, TRUE)); + (buf->b_changed || file_ff_differs(buf, true)); } int curbufIsChanged(void) { return !bt_dontwrite(curbuf) && - (curbuf->b_changed || file_ff_differs(curbuf, TRUE)); + (curbuf->b_changed || file_ff_differs(curbuf, true)); } /* diff --git a/src/nvim/window.c b/src/nvim/window.c index 302a957d87..161f653536 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -321,7 +321,7 @@ newwindow: /* make all windows the same height */ case '=': - win_equal(NULL, FALSE, 'b'); + win_equal(NULL, false, 'b'); break; /* 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. */ if (do_equal || dir != 0) - win_equal(wp, TRUE, + win_equal(wp, true, (flags & WSP_VERT) ? (dir == 'v' ? 'b' : 'h') : dir == 'h' ? 'b' : 'v'); @@ -1331,7 +1331,7 @@ static void win_totop(int size, int flags) if (!(flags & WSP_VERT)) { win_setheight(height); 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 * rows. */ -void -win_equal ( - win_T *next_curwin, /* pointer to current window to be or NULL */ - int current, /* do only frame with current window */ - int dir /* 'v' for vertically, 'h' for horizontally, - 'b' for both, 0 for using p_ead */ +void win_equal( + win_T *next_curwin, // pointer to current window to be or NULL + bool current, // do only frame with current window + int dir // 'v' for vertically, 'h' for horizontally, + // 'b' for both, 0 for using p_ead ) { if (dir == 0) @@ -1414,10 +1413,9 @@ win_equal ( * The window "next_curwin" (if not NULL) should at least get the size from * 'winheight' and 'winwidth' if possible. */ -static void -win_equal_rec ( +static void win_equal_rec( 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 */ int dir, /* 'v', 'h' or 'b', see win_equal() */ int col, /* horizontal position for frame */ @@ -1972,12 +1970,12 @@ int win_close(win_T *win, int free_buf) } if (p_ea && (*p_ead == 'b' || *p_ead == dir) - ) - win_equal(curwin, TRUE, - dir - ); - else + ) { + win_equal(curwin, true, dir); + } else { win_comp_pos(); + } + if (close_curwin) { win_enter_ext(wp, false, TRUE, TRUE, TRUE); if (other_buffer)